ReactOS  0.4.14-dev-614-gbfd8a84
diskspace.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "winreg.h"
#include "setupapi.h"
#include "wine/test.h"
Include dependency graph for diskspace.c:

Go to the source code of this file.

Classes

struct  device_usage
 
struct  section
 
struct  section_i
 

Macros

#define STD_HEADER   "[Version]\r\nSignature=\"$CHICAGO$\"\r\n"
 

Functions

static const chardebugstr_longlong (ULONGLONG ll)
 
static HINF inf_open_file_content (const char *tmpfilename, const char *data, UINT *err_line)
 
static void test_SetupCreateDiskSpaceListA (void)
 
static void test_SetupCreateDiskSpaceListW (void)
 
static void test_SetupDuplicateDiskSpaceListA (void)
 
static void test_SetupDuplicateDiskSpaceListW (void)
 
static LONGLONG get_file_size (char *path)
 
static void test_SetupQuerySpaceRequiredOnDriveA (void)
 
static void test_SetupQuerySpaceRequiredOnDriveW (void)
 
static void test_SetupAddToDiskSpaceListA (void)
 
static void test_SetupQueryDrivesInDiskSpaceListA (void)
 
static void test_SetupAddSectionToDiskSpaceListA (void)
 
static void test_SetupAddInstallSectionToDiskSpaceListA (void)
 
 START_TEST (diskspace)
 

Variables

static BOOL is_win9x
 
struct {
   const char *   data
 
   struct section   sections [2]
 
   const char *   devices
 
   int   device_length
 
   struct device_usage   usage [2]
 
section_test []
 
struct {
   const char *   data
 
   struct section_i   sections [2]
 
   const char *   devices
 
   int   device_length
 
   struct device_usage   usage [2]
 
section_test_i []
 

Macro Definition Documentation

◆ STD_HEADER

#define STD_HEADER   "[Version]\r\nSignature=\"$CHICAGO$\"\r\n"

Definition at line 35 of file diskspace.c.

Function Documentation

◆ debugstr_longlong()

static const char* debugstr_longlong ( ULONGLONG  ll)
inlinestatic

Definition at line 37 of file diskspace.c.

38 {
39  static char string[17];
40  if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
41  sprintf(string, "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll);
42  else
43  sprintf(string, "%lx", (unsigned long)ll);
44  return string;
45 }
#define sprintf(buf, format,...)
Definition: sprintf.c:55
char string[160]
Definition: util.h:11
w ll
Definition: byte_order.h:166

Referenced by test_SetupQuerySpaceRequiredOnDriveA().

◆ get_file_size()

static LONGLONG get_file_size ( char path)
static

Definition at line 328 of file diskspace.c.

329 {
330  HANDLE file;
332 
335  if (file == INVALID_HANDLE_VALUE) return 0;
336 
337  if (!GetFileSizeEx(file, &size))
338  size.QuadPart = 0;
339 
340  CloseHandle(file);
341  return size.QuadPart;
342 }
#define CloseHandle
Definition: compat.h:406
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
GLsizeiptr size
Definition: glext.h:5919
const char file[]
Definition: icontest.c:11
#define GetFileSizeEx
Definition: compat.h:422
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
Definition: fci.c:126

Referenced by test_SetupQuerySpaceRequiredOnDriveA().

◆ inf_open_file_content()

static HINF inf_open_file_content ( const char tmpfilename,
const char data,
UINT err_line 
)
static

Definition at line 48 of file diskspace.c.

49 {
50  DWORD res;
53  if (handle == INVALID_HANDLE_VALUE) return 0;
54  if (!WriteFile( handle, data, strlen(data), &res, NULL )) trace( "write error\n" );
57 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:406
#define INF_STYLE_WIN4
Definition: infsupp.h:41
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define trace
Definition: atltest.h:70
static const char tmpfilename[]
Definition: parser.c:49
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GENERIC_READ
Definition: compat.h:124
HINF WINAPI SetupOpenInfFileA(PCSTR name, PCSTR class, DWORD style, UINT *error)
Definition: parser.c:1139
#define CREATE_ALWAYS
Definition: disk.h:72
UINT err_line
Definition: parser.c:106
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407

Referenced by test_SetupAddInstallSectionToDiskSpaceListA(), and test_SetupAddSectionToDiskSpaceListA().

◆ START_TEST()

START_TEST ( diskspace  )

Definition at line 1119 of file diskspace.c.

1120 {
1121  is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
1133 }
static void test_SetupAddToDiskSpaceListA(void)
Definition: diskspace.c:669
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void test_SetupQueryDrivesInDiskSpaceListA(void)
Definition: diskspace.c:703
static void test_SetupCreateDiskSpaceListA(void)
Definition: diskspace.c:59
static BOOL is_win9x
Definition: diskspace.c:33
static void test_SetupQuerySpaceRequiredOnDriveA(void)
Definition: diskspace.c:344
static void test_SetupQuerySpaceRequiredOnDriveW(void)
Definition: diskspace.c:582
HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:38
static void test_SetupAddInstallSectionToDiskSpaceListA(void)
Definition: diskspace.c:1012
static void test_SetupDuplicateDiskSpaceListA(void)
Definition: diskspace.c:176
static void test_SetupAddSectionToDiskSpaceListA(void)
Definition: diskspace.c:841
static void test_SetupCreateDiskSpaceListW(void)
Definition: diskspace.c:115
static void test_SetupDuplicateDiskSpaceListW(void)
Definition: diskspace.c:252
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ test_SetupAddInstallSectionToDiskSpaceListA()

static void test_SetupAddInstallSectionToDiskSpaceListA ( void  )
static

Definition at line 1012 of file diskspace.c.

1013 {
1014  char tmp[MAX_PATH];
1015  char tmpfilename[MAX_PATH];
1016  char buffer[MAX_PATH];
1017  HDSKSPC diskspace;
1018  LONGLONG space;
1019  UINT err_line;
1020  BOOL ret;
1021  int i, j;
1022  HINF inf;
1023 
1024  if (!GetTempPathA(MAX_PATH, tmp))
1025  {
1026  win_skip("GetTempPath failed with error %d\n", GetLastError());
1027  return;
1028  }
1029 
1030  if (!GetTempFileNameA(tmp, "inftest", 0, tmpfilename))
1031  {
1032  win_skip("GetTempFileNameA failed with error %d\n", GetLastError());
1033  return;
1034  }
1035 
1036  inf = inf_open_file_content(tmpfilename, STD_HEADER "[a]\nCopyFiles=b\n[b]\ntest,,,\n[SourceDisksFiles]\ntest=1,,4096\r\n", &err_line);
1037  ok(!!inf, "Failed to open inf file (%d, line %d)\n", GetLastError(), err_line);
1038 
1040  ok(diskspace != NULL,"Expected SetupCreateDiskSpaceListA to return a valid handle\n");
1041 
1042  ret = SetupAddInstallSectionToDiskSpaceListA(diskspace, NULL, NULL, "a", 0, 0);
1043  ok(ret, "Expected SetupAddInstallSectionToDiskSpaceListA to succeed\n");
1044 
1046  ok(!ret, "Expected SetupAddInstallSectionToDiskSpaceListA to fail\n");
1047  ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE as error, got %u\n",
1048  GetLastError());
1049 
1050  ret = SetupAddInstallSectionToDiskSpaceListA(diskspace, inf, NULL, NULL, 0, 0);
1051  ok(!ret || broken(ret), "Expected SetupAddSectionToDiskSpaceListA to fail\n");
1053  "Expected ERROR_INVALID_PARAMETER as error, got %u\n", GetLastError());
1054 
1055  ret = SetupAddInstallSectionToDiskSpaceListA(diskspace, inf, NULL, "", 0, 0);
1056  ok(ret, "Expected SetupAddInstallSectionToDiskSpaceListA to succeed (%u)\n", GetLastError());
1057 
1058  ok(SetupDestroyDiskSpaceList(diskspace),
1059  "Expected SetupDestroyDiskSpaceList to succeed\n");
1060 
1061  for (i = 0; i < sizeof(section_test_i) / sizeof(section_test_i[0]); i++)
1062  {
1063  err_line = 0;
1064 
1066  ok(!!inf, "test %d: Failed to open inf file (%d, line %d)\n", i, GetLastError(), err_line);
1067  if (!inf) continue;
1068 
1070  ok(diskspace != NULL,"Expected SetupCreateDiskSpaceListA to return a valid handle\n");
1071 
1072  for (j = 0; j < 2; j++)
1073  {
1074  const struct section_i *section = &section_test_i[i].sections[j];
1075  if (!section->name)
1076  continue;
1077 
1078  SetLastError(0xdeadbeef);
1079  ret = SetupAddInstallSectionToDiskSpaceListA(diskspace, inf, NULL, section->name, 0, 0);
1080  if (section->result)
1081  ok(ret, "test %d: Expected adding section %d to succeed (%u)\n", i, j, GetLastError());
1082  else
1083  {
1084  ok(!ret, "test %d: Expected adding section %d to fail\n", i, j);
1085  ok(GetLastError() == section->error_code, "test %d: Expected %u as error, got %u\n",
1087  }
1088  }
1089 
1090  memset(buffer, 0x0, sizeof(buffer));
1091  ret = SetupQueryDrivesInDiskSpaceListA(diskspace, buffer, sizeof(buffer), NULL);
1092  ok(ret, "test %d: Expected SetupQueryDrivesInDiskSpaceListA to succeed (%u)\n", i, GetLastError());
1094  "test %d: Device list (%s) does not match\n", i, buffer);
1095 
1096  for (j = 0; j < 2; j++)
1097  {
1098  const struct device_usage *usage = &section_test_i[i].usage[j];
1099  if (!usage->dev)
1100  continue;
1101 
1102  space = 0;
1103  ret = SetupQuerySpaceRequiredOnDriveA(diskspace, usage->dev, &space, NULL, 0);
1104  ok(ret, "test %d: Expected SetupQuerySpaceRequiredOnDriveA to succeed for device %s (%u)\n",
1105  i, usage->dev, GetLastError());
1106  ok(space == usage->usage, "test %d: Expected size %u for device %s, got %u\n",
1107  i, (DWORD)usage->usage, usage->dev, (DWORD)space);
1108  }
1109 
1110  ok(SetupDestroyDiskSpaceList(diskspace),
1111  "Expected SetupDestroyDiskSpaceList to succeed\n");
1112 
1113  SetupCloseInfFile(inf);
1114  }
1115 
1117 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
#define STD_HEADER
Definition: diskspace.c:35
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, LPCSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
Definition: diskspace.c:201
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLint x0
Definition: linetemp.h:95
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, LPCSTR SectionName, PVOID Reserved1, UINT Reserved2)
Definition: diskspace.c:136
static const struct @1649 section_test_i[]
const char * devices
Definition: diskspace.c:793
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
WINSETUPAPI BOOL WINAPI SetupQueryDrivesInDiskSpaceListA(_In_ HDSKSPC DiskSpace, _Out_writes_opt_(ReturnBufferSize) PSTR ReturnBuffer, _In_ DWORD ReturnBufferSize, _Out_opt_ PDWORD RequiredSize)
Definition: parser.c:55
BOOL result
Definition: diskspace.c:785
int device_length
Definition: diskspace.c:794
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
const WCHAR * name
Definition: parser.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int64_t LONGLONG
Definition: typedefs.h:66
DWORD error_code
Definition: diskspace.c:786
#define MAX_PATH
Definition: compat.h:26
static const char tmpfilename[]
Definition: parser.c:49
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define broken(x)
Definition: _sntprintf.h:21
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define ok(value,...)
Definition: atltest.h:57
static HINF inf_open_file_content(const char *tmpfilename, const char *data, UINT *err_line)
Definition: diskspace.c:48
unsigned int UINT
Definition: ndis.h:50
UINT err_line
Definition: parser.c:106
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26

Referenced by START_TEST().

◆ test_SetupAddSectionToDiskSpaceListA()

static void test_SetupAddSectionToDiskSpaceListA ( void  )
static

Definition at line 841 of file diskspace.c.

842 {
843  char tmp[MAX_PATH];
844  char tmpfilename[MAX_PATH];
845  char buffer[MAX_PATH];
846  HDSKSPC diskspace;
847  UINT err_line;
848  LONGLONG space;
849  BOOL ret;
850  int i, j;
851  HINF inf;
852 
853  if (!GetTempPathA(MAX_PATH, tmp))
854  {
855  win_skip("GetTempPath failed with error %d\n", GetLastError());
856  return;
857  }
858 
859  if (!GetTempFileNameA(tmp, "inftest", 0, tmpfilename))
860  {
861  win_skip("GetTempFileNameA failed with error %d\n", GetLastError());
862  return;
863  }
864 
865  inf = inf_open_file_content(tmpfilename, STD_HEADER "[a]\ntest,,,\n[SourceDisksFiles]\ntest=1,,4096\r\n", &err_line);
866  ok(!!inf, "Failed to open inf file (%d, line %d)\n", GetLastError(), err_line);
867 
869  ok(diskspace != NULL,"Expected SetupCreateDiskSpaceListA to return a valid handle\n");
870 
871  ret = SetupAddSectionToDiskSpaceListA(diskspace, NULL, NULL, "a", FILEOP_COPY, 0, 0);
872  ok(!ret, "Expected SetupAddSectionToDiskSpaceListA to fail\n");
873  ok(GetLastError() == ERROR_SECTION_NOT_FOUND, "Expected ERROR_SECTION_NOT_FOUND as error, got %u\n",
874  GetLastError());
875 
877  ok(!ret, "Expected SetupAddSectionToDiskSpaceListA to fail\n");
878  ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE as error, got %u\n",
879  GetLastError());
880 
882  ok(!ret, "Expected SetupAddSectionToDiskSpaceListA to fail\n");
883  ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE as error, got %u\n",
884  GetLastError());
885 
886  ret = SetupAddSectionToDiskSpaceListA(diskspace, inf, NULL, "a", 0, 0, 0);
887  ok(ret, "Expected SetupAddSectionToDiskSpaceListA to succeed (%u)\n", GetLastError());
888 
889  ok(SetupDestroyDiskSpaceList(diskspace),
890  "Expected SetupDestroyDiskSpaceList to succeed\n");
891 
892  for (i = 0; i < sizeof(section_test) / sizeof(section_test[0]); i++)
893  {
894  err_line = 0;
895 
897  ok(!!inf, "test %d: Failed to open inf file (%d, line %d)\n", i, GetLastError(), err_line);
898  if (!inf) continue;
899 
901  ok(diskspace != NULL, "Expected SetupCreateDiskSpaceListA to return a valid handle\n");
902 
903  for (j = 0; j < 2; j++)
904  {
905  const struct section *section = &section_test[i].sections[j];
906  if (!section->name)
907  continue;
908 
909  SetLastError(0xdeadbeef);
910  ret = SetupAddSectionToDiskSpaceListA(diskspace, inf, NULL, section->name, section->fileop, 0, 0);
911  if (section->result)
912  ok(ret, "test %d: Expected adding section %d to succeed (%u)\n", i, j, GetLastError());
913  else
914  {
915  ok(!ret, "test %d: Expected adding section %d to fail\n", i, j);
916  ok(GetLastError() == section->error_code, "test %d: Expected %u as error, got %u\n",
918  }
919  }
920 
921  memset(buffer, 0x0, sizeof(buffer));
922  ret = SetupQueryDrivesInDiskSpaceListA(diskspace, buffer, sizeof(buffer), NULL);
923  ok(ret, "test %d: Expected SetupQueryDrivesInDiskSpaceListA to succeed (%u)\n", i, GetLastError());
925  "test %d: Device list (%s) does not match\n", i, buffer);
926 
927  for (j = 0; j < 2; j++)
928  {
929  const struct device_usage *usage = &section_test[i].usage[j];
930  if (!usage->dev)
931  continue;
932 
933  space = 0;
934  ret = SetupQuerySpaceRequiredOnDriveA(diskspace, usage->dev, &space, NULL, 0);
935  ok(ret, "test %d: Expected SetupQuerySpaceRequiredOnDriveA to succeed for device %s (%u)\n",
936  i, usage->dev, GetLastError());
937  ok(space == usage->usage, "test %d: Expected size %u for device %s, got %u\n",
938  i, (DWORD)usage->usage, usage->dev, (DWORD)space);
939  }
940 
941  ok(SetupDestroyDiskSpaceList(diskspace),
942  "Expected SetupDestroyDiskSpaceList to succeed\n");
943 
944  SetupCloseInfFile(inf);
945  }
946 
948 }
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
#define STD_HEADER
Definition: diskspace.c:35
#define ERROR_SECTION_NOT_FOUND
Definition: setupapi.h:288
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, LPCSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
Definition: diskspace.c:201
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLint x0
Definition: linetemp.h:95
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
const char * devices
Definition: diskspace.c:793
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
WINSETUPAPI BOOL WINAPI SetupQueryDrivesInDiskSpaceListA(_In_ HDSKSPC DiskSpace, _Out_writes_opt_(ReturnBufferSize) PSTR ReturnBuffer, _In_ DWORD ReturnBufferSize, _Out_opt_ PDWORD RequiredSize)
Definition: parser.c:55
BOOL result
Definition: diskspace.c:785
int device_length
Definition: diskspace.c:794
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
const WCHAR * name
Definition: parser.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILEOP_COPY
Definition: fileqsup.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int64_t LONGLONG
Definition: typedefs.h:66
DWORD error_code
Definition: diskspace.c:786
static const struct @1648 section_test[]
#define MAX_PATH
Definition: compat.h:26
static const char tmpfilename[]
Definition: parser.c:49
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
WINSETUPAPI BOOL WINAPI SetupAddSectionToDiskSpaceListA(_In_ HDSKSPC, _In_ HINF, _In_opt_ HINF, _In_ PCSTR, _In_ UINT, _Reserved_ PVOID, _Reserved_ UINT)
UINT fileop
Definition: diskspace.c:784
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
#define ok(value,...)
Definition: atltest.h:57
static HINF inf_open_file_content(const char *tmpfilename, const char *data, UINT *err_line)
Definition: diskspace.c:48
unsigned int UINT
Definition: ndis.h:50
UINT err_line
Definition: parser.c:106
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26

Referenced by START_TEST().

◆ test_SetupAddToDiskSpaceListA()

static void test_SetupAddToDiskSpaceListA ( void  )
static

Definition at line 669 of file diskspace.c.

670 {
671  HDSKSPC handle;
672  BOOL ret;
673 
674  ret = SetupAddToDiskSpaceListA(NULL, "C:\\some-file.dat", 0, FILEOP_COPY, 0, 0);
675  ok(!ret, "Expected SetupAddToDiskSpaceListA to return FALSE, got %d\n", ret);
677  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
678 
680  ok(handle != NULL,"Expected SetupCreateDiskSpaceListA to return a valid handle\n");
681 
683  ok(ret || broken(!ret) /* >= Vista */, "Expected SetupAddToDiskSpaceListA to succeed\n");
684 
685  ret = SetupAddToDiskSpaceListA(handle, "C:\\some-file.dat", -20, FILEOP_COPY, 0, 0);
686  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
687 
688  ret = SetupAddToDiskSpaceListA(handle, "C:\\some-file.dat", 0, FILEOP_RENAME, 0, 0);
689  ok(!ret, "Expected SetupAddToDiskSpaceListA to return FALSE\n");
691  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
692 
694  ok(ret || broken(!ret) /* >= Vista */, "Expected SetupAddToDiskSpaceListA to succeed\n");
695 
697  ok(ret || broken(!ret) /* >= Vista */, "Expected SetupAddToDiskSpaceListA to succeed\n");
698 
700  "Expected SetupDestroyDiskSpaceList to succeed\n");
701 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
#define FILEOP_RENAME
Definition: fileqsup.h:43
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILEOP_COPY
Definition: fileqsup.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupAddToDiskSpaceListA(HDSKSPC diskspace, PCSTR targetfile, LONGLONG filesize, UINT operation, PVOID reserved1, UINT reserved2)
Definition: diskspace.c:255
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_SetupCreateDiskSpaceListA()

static void test_SetupCreateDiskSpaceListA ( void  )
static

Definition at line 59 of file diskspace.c.

60 {
61  HDSKSPC ret;
62 
64  ok(ret != NULL,
65  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
66 
67  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
68 
70  ok(ret != NULL,
71  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
72 
73  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
74 
75  SetLastError(0xdeadbeef);
77  ok(ret == NULL ||
78  broken(ret != NULL), /* NT4/Win9x/Win2k */
79  "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
80  if (!ret)
82  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
83  GetLastError());
84  else
85  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
86 
87  SetLastError(0xdeadbeef);
88  ret = SetupCreateDiskSpaceListA(NULL, 0xdeadbeef, 0);
89  ok(ret == NULL,
90  "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
92  broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
93  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
94  GetLastError());
95 
96  SetLastError(0xdeadbeef);
97  ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0, 0);
98  ok(ret == NULL,
99  "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
101  broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
102  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
103  GetLastError());
104 
105  SetLastError(0xdeadbeef);
106  ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0xdeadbeef, 0);
107  ok(ret == NULL,
108  "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
110  broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
111  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
112  GetLastError());
113 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define U(x)
Definition: wordpad.c:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:417
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_SetupCreateDiskSpaceListW()

static void test_SetupCreateDiskSpaceListW ( void  )
static

Definition at line 115 of file diskspace.c.

116 {
117  HDSKSPC ret;
118 
121  {
122  win_skip("SetupCreateDiskSpaceListW is not implemented\n");
123  return;
124  }
125  ok(ret != NULL,
126  "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
127 
128  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
129 
131  ok(ret != NULL,
132  "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
133 
134  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
135 
136  SetLastError(0xdeadbeef);
138  ok(ret == NULL ||
139  broken(ret != NULL), /* NT4/Win2k */
140  "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
141  if (!ret)
143  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
144  GetLastError());
145  else
146  ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
147 
148  SetLastError(0xdeadbeef);
149  ret = SetupCreateDiskSpaceListW(NULL, 0xdeadbeef, 0);
150  ok(ret == NULL,
151  "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
153  broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
154  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
155  GetLastError());
156 
157  SetLastError(0xdeadbeef);
158  ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0, 0);
159  ok(ret == NULL,
160  "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
162  broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
163  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
164  GetLastError());
165 
166  SetLastError(0xdeadbeef);
167  ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0);
168  ok(ret == NULL,
169  "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
171  broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
172  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
173  GetLastError());
174 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define U(x)
Definition: wordpad.c:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:38
#define SetLastError(x)
Definition: compat.h:417
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_SetupDuplicateDiskSpaceListA()

static void test_SetupDuplicateDiskSpaceListA ( void  )
static

Definition at line 176 of file diskspace.c.

177 {
178  HDSKSPC handle, duplicate;
179 
180  if (is_win9x)
181  win_skip("SetupDuplicateDiskSpaceListA crashes with NULL disk space handle on Win9x\n");
182  else
183  {
184  SetLastError(0xdeadbeef);
185  duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, 0);
186  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
188  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
189 
190  SetLastError(0xdeadbeef);
191  duplicate = SetupDuplicateDiskSpaceListA(NULL, (void *)0xdeadbeef, 0, 0);
192  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
194  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
195 
196  SetLastError(0xdeadbeef);
197  duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0xdeadbeef, 0);
198  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
200  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
201 
202  SetLastError(0xdeadbeef);
203  duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, ~0U);
204  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
206  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
207  }
208 
210  ok(handle != NULL,
211  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
212 
213  if (!handle)
214  {
215  skip("Failed to create a disk space handle\n");
216  return;
217  }
218 
219  SetLastError(0xdeadbeef);
220  duplicate = SetupDuplicateDiskSpaceListA(handle, (void *)0xdeadbeef, 0, 0);
221  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
223  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
224 
225  SetLastError(0xdeadbeef);
226  duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0xdeadbeef, 0);
227  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
229  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
230 
231  SetLastError(0xdeadbeef);
233  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
235  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
236 
237  SetLastError(0xdeadbeef);
238  duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, ~0U);
239  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
241  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
242 
243  duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, 0);
244  ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
245  ok(duplicate != handle,
246  "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
247 
248  ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
249  ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
250 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define U(x)
Definition: wordpad.c:44
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static BOOL is_win9x
Definition: diskspace.c:33
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:417
HDSKSPC WINAPI SetupDuplicateDiskSpaceListA(HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:128
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_SetupDuplicateDiskSpaceListW()

static void test_SetupDuplicateDiskSpaceListW ( void  )
static

Definition at line 252 of file diskspace.c.

253 {
254  HDSKSPC handle, duplicate;
255 
256  SetLastError(0xdeadbeef);
257  duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, 0);
258  if (!duplicate && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
259  {
260  win_skip("SetupDuplicateDiskSpaceListW is not available\n");
261  return;
262  }
263  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
265  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
266 
267  SetLastError(0xdeadbeef);
268  duplicate = SetupDuplicateDiskSpaceListW(NULL, (void *)0xdeadbeef, 0, 0);
269  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
271  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
272 
273  SetLastError(0xdeadbeef);
274  duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0xdeadbeef, 0);
275  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
277  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
278 
279  SetLastError(0xdeadbeef);
280  duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, ~0U);
281  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
283  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
284 
286  ok(handle != NULL,
287  "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
288 
289  if (!handle)
290  {
291  skip("Failed to create a disk space handle\n");
292  return;
293  }
294 
295  SetLastError(0xdeadbeef);
296  duplicate = SetupDuplicateDiskSpaceListW(handle, (void *)0xdeadbeef, 0, 0);
297  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
299  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
300 
301  SetLastError(0xdeadbeef);
302  duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0xdeadbeef, 0);
303  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
305  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
306 
307  SetLastError(0xdeadbeef);
309  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
311  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
312 
313  SetLastError(0xdeadbeef);
314  duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, ~0U);
315  ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
317  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
318 
319  duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, 0);
320  ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
321  ok(duplicate != handle,
322  "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
323 
324  ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
325  ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
326 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define U(x)
Definition: wordpad.c:44
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDSKSPC WINAPI SetupDuplicateDiskSpaceListW(HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:97
smooth NULL
Definition: ftsmooth.c:416
HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:38
#define SetLastError(x)
Definition: compat.h:417
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

◆ test_SetupQueryDrivesInDiskSpaceListA()

static void test_SetupQueryDrivesInDiskSpaceListA ( void  )
static

Definition at line 703 of file diskspace.c.

704 {
705  char buffer[MAX_PATH];
706  HDSKSPC handle;
707  DWORD size;
708  BOOL ret;
709 
711  ok(handle != NULL,"Expected SetupCreateDiskSpaceListA to return a valid handle\n");
712 
714  ok(ret, "Expected SetupQueryDrivesInDiskSpaceListA to succeed\n");
715 
716  size = 0;
718  ok(ret, "Expected SetupQueryDrivesInDiskSpaceListA to succeed\n");
719  ok(size == 1, "Expected size 1, got %u\n", size);
720 
721  ret = SetupAddToDiskSpaceListA(handle, "F:\\random-file.dat", 0, FILEOP_COPY, 0, 0);
722  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
723 
724  ret = SetupAddToDiskSpaceListA(handle, "G:\\random-file.dat", 0, FILEOP_COPY, 0, 0);
725  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
726 
727  ret = SetupAddToDiskSpaceListA(handle, "G:\\random-file2.dat", 0, FILEOP_COPY, 0, 0);
728  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
729 
730  ret = SetupAddToDiskSpaceListA(handle, "X:\\random-file.dat", 0, FILEOP_COPY, 0, 0);
731  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
732 
733  size = 0;
735  ok(ret, "Expected SetupQueryDrivesInDiskSpaceListA to succeed\n");
736  ok(size == 10, "Expected size 10, got %u\n", size);
737 
738  size = 0;
740  ok(!ret, "Expected SetupQueryDrivesInDiskSpaceListA to fail\n");
741  ok(size == 4, "Expected size 4, got %u\n", size);
743  "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
744 
745  size = 0;
747  ok(!ret, "Expected SetupQueryDrivesInDiskSpaceListA to fail\n");
748  ok(size == 7, "Expected size 7, got %u\n", size);
750  "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
751 
752  size = 0;
754  ok(!ret, "Expected SetupQueryDrivesInDiskSpaceListA to fail\n");
755  ok(size == 10, "Expected size 10, got %u\n", size);
757  "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
758 
759  size = 0;
760  memset(buffer, 0xff, sizeof(buffer));
762  ok(ret, "Expected SetupQueryDrivesInDiskSpaceListA to succeed\n");
763  ok(size == 10, "Expected size 10, got %u\n", size);
764  ok(!memcmp("f:\0g:\0x:\0\0", buffer, 10), "Device list does not match\n");
765 
766  memset(buffer, 0xff, sizeof(buffer));
768  ok(ret, "Expected SetupQueryDrivesInDiskSpaceListA to succeed\n");
769  ok(!memcmp("f:\0g:\0x:\0\0", buffer, 10), "Device list does not match\n");
770 
772  "Expected SetupDestroyDiskSpaceList to succeed\n");
773 }
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
WINSETUPAPI BOOL WINAPI SetupQueryDrivesInDiskSpaceListA(_In_ HDSKSPC DiskSpace, _Out_writes_opt_(ReturnBufferSize) PSTR ReturnBuffer, _In_ DWORD ReturnBufferSize, _Out_opt_ PDWORD RequiredSize)
#define FILEOP_COPY
Definition: fileqsup.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupAddToDiskSpaceListA(HDSKSPC diskspace, PCSTR targetfile, LONGLONG filesize, UINT operation, PVOID reserved1, UINT reserved2)
Definition: diskspace.c:255
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_SetupQuerySpaceRequiredOnDriveA()

static void test_SetupQuerySpaceRequiredOnDriveA ( void  )
static

Definition at line 344 of file diskspace.c.

345 {
346  BOOL ret;
347  HDSKSPC handle;
348  LONGLONG space;
349  char windir[MAX_PATH];
350  char drive[3];
351  char tmp[MAX_PATH];
352  LONGLONG size;
353 
354  if (is_win9x)
355  win_skip("SetupQuerySpaceRequiredOnDriveA crashes with NULL disk space handle on Win9x\n");
356  else
357  {
358  SetLastError(0xdeadbeef);
360  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
362  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
363  GetLastError());
364 
365  SetLastError(0xdeadbeef);
366  space = 0xdeadbeef;
368  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
369  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
371  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
372  GetLastError());
373 
374  SetLastError(0xdeadbeef);
376  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
378  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
379  GetLastError());
380 
381  SetLastError(0xdeadbeef);
382  space = 0xdeadbeef;
384  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
385  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
387  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
388  GetLastError());
389  }
390 
392  ok(handle != NULL,
393  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
394 
395  SetLastError(0xdeadbeef);
397  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
399  GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
400  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
401  GetLastError());
402 
403  SetLastError(0xdeadbeef);
404  space = 0xdeadbeef;
406  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
407  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
409  GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
410  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
411  GetLastError());
412 
413  SetLastError(0xdeadbeef);
415  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
417  "Expected GetLastError() to return ERROR_INVALID_DRIVE, got %u\n",
418  GetLastError());
419 
420  SetLastError(0xdeadbeef);
421  space = 0xdeadbeef;
423  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
424  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
426  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
427  GetLastError());
428 
430  drive[0] = windir[0]; drive[1] = windir[1]; drive[2] = 0;
431 
432  snprintf(tmp, MAX_PATH, "%c:\\wine-test-should-not-exist.txt", drive[0]);
433  ret = SetupAddToDiskSpaceListA(handle, tmp, 0x100000, FILEOP_COPY, 0, 0);
434  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
435 
436  space = 0;
438  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
439  ok(space == 0x100000, "Expected 0x100000 as required space, got %s\n", debugstr_longlong(space));
440 
441  /* adding the same file again doesn't sum up the size */
442  ret = SetupAddToDiskSpaceListA(handle, tmp, 0x200000, FILEOP_COPY, 0, 0);
443  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
444 
445  space = 0;
447  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
448  ok(space == 0x200000, "Expected 0x200000 as required space, got %s\n", debugstr_longlong(space));
449 
450  /* the device doesn't need to exist */
451  snprintf(tmp, MAX_PATH, "F:\\wine-test-should-not-exist.txt");
452  ret = SetupAddToDiskSpaceListA(handle, tmp, 0x200000, FILEOP_COPY, 0, 0);
453  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
454 
456  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
457  ok(space == 0x200000, "Expected 0x200000 as required space, got %s\n", debugstr_longlong(space));
458 
459  snprintf(tmp, MAX_PATH, "F:\\wine-test-should-not-exist.txt");
460  ret = SetupAddToDiskSpaceListA(handle, tmp, 0x200000, FILEOP_DELETE, 0, 0);
461  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
462 
464  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
465  ok(space == 0x200000, "Expected 0x200000 as required space, got %s\n", debugstr_longlong(space));
466 
468  "Expected SetupDestroyDiskSpaceList to succeed\n");
469 
471  ok(handle != NULL,
472  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
473 
474  /* the real size is subtracted unless SPDSL_IGNORE_DISK is specified */
475  snprintf(tmp, MAX_PATH, "%s\\regedit.exe", windir);
476 
477  size = get_file_size(tmp);
479  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
480  space = 0;
482  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
483  ok(space == 0 || broken(space == -0x5000) || broken(space == -0x7000),
484  "Expected 0x0 as required space, got %s\n", debugstr_longlong(space));
485 
486  ret = SetupAddToDiskSpaceListA(handle, tmp, size + 0x100000, FILEOP_COPY, 0, 0);
487  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
489  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
490  ok(space == 0x100000 || broken(space == 0xf9000) || broken(space == 0xfb000),
491  "Expected 0x100000 as required space, got %s\n", debugstr_longlong(space));
492 
493  ret = SetupAddToDiskSpaceListA(handle, tmp, size - 0x1000, FILEOP_COPY, 0, 0);
494  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
496  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
497  ok(space == -0x1000 || broken(space == -0x6000) || broken(space == -0x8000),
498  "Expected -0x1000 as required space, got %s\n", debugstr_longlong(space));
499 
501  "Expected SetupDestroyDiskSpaceList to succeed\n");
502 
503  /* test FILEOP_DELETE, then FILEOP_COPY */
505  ok(handle != NULL,
506  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
507 
509  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
511  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
512 
513  space = 0;
515  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
516  ok(space == 0 || broken(space == -0x5000) || broken(space == -0x7000),
517  "Expected 0x0 as required space, got %s\n", debugstr_longlong(space));
518 
520  "Expected SetupDestroyDiskSpaceList to succeed\n");
521 
522  /* test FILEOP_COPY, then FILEOP_DELETE */
524  ok(handle != NULL,
525  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
526 
528  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
530  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
531 
532  space = 0;
534  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
535  ok(space == 0 || broken(space == -0x5000) || broken(space == -0x7000),
536  "Expected 0x0 as required space, got %s\n", debugstr_longlong(space));
537 
539  "Expected SetupDestroyDiskSpaceList to succeed\n");
540 
541  /* test FILEOP_DELETE without SPDSL_IGNORE_DISK */
543  ok(handle != NULL,
544  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
545 
547  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
548  space = 0;
550  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
551  ok(space <= -size, "Expected space <= -size, got %s\n", debugstr_longlong(space));
552 
554  "Expected SetupDestroyDiskSpaceList to succeed\n");
555 
556  /* test FILEOP_COPY and FILEOP_DELETE with SPDSL_IGNORE_DISK */
558  ok(handle != NULL,
559  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
560 
562  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
563  space = 0;
565  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
566  ok(space == 0, "Expected size = 0, got %s\n", debugstr_longlong(space));
567 
569  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
571  ok(ret, "Expected SetupAddToDiskSpaceListA to succeed\n");
572 
573  space = 0;
575  ok(ret, "Expected SetupQuerySpaceRequiredOnDriveA to succeed\n");
576  ok(space >= size, "Expected size >= %s\n", debugstr_longlong(space));
577 
579  "Expected SetupDestroyDiskSpaceList to succeed\n");
580 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, LPCSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
Definition: diskspace.c:201
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
static const char * debugstr_longlong(ULONGLONG ll)
Definition: diskspace.c:37
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define snprintf
Definition: wintirpc.h:48
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static BOOL is_win9x
Definition: diskspace.c:33
#define FILEOP_COPY
Definition: fileqsup.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupAddToDiskSpaceListA(HDSKSPC diskspace, PCSTR targetfile, LONGLONG filesize, UINT operation, PVOID reserved1, UINT reserved2)
Definition: diskspace.c:255
int64_t LONGLONG
Definition: typedefs.h:66
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
#define SetLastError(x)
Definition: compat.h:417
int ret
#define ERROR_INVALID_DRIVE
Definition: winerror.h:118
#define broken(x)
Definition: _sntprintf.h:21
static LONGLONG get_file_size(char *path)
Definition: diskspace.c:328
#define ok(value,...)
Definition: atltest.h:57
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
#define win_skip
Definition: test.h:150
#define FILEOP_DELETE
Definition: fileqsup.h:44

Referenced by START_TEST().

◆ test_SetupQuerySpaceRequiredOnDriveW()

static void test_SetupQuerySpaceRequiredOnDriveW ( void  )
static

Definition at line 582 of file diskspace.c.

583 {
584  static const WCHAR emptyW[] = {0};
585 
586  BOOL ret;
587  HDSKSPC handle;
588  LONGLONG space;
589 
590  SetLastError(0xdeadbeef);
593  {
594  win_skip("SetupQuerySpaceRequiredOnDriveW is not available\n");
595  return;
596  }
597  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
599  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
600  GetLastError());
601 
602  SetLastError(0xdeadbeef);
603  space = 0xdeadbeef;
605  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
606  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
608  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
609  GetLastError());
610 
611  SetLastError(0xdeadbeef);
613  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
615  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
616  GetLastError());
617 
618  SetLastError(0xdeadbeef);
619  space = 0xdeadbeef;
621  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
622  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
624  "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
625  GetLastError());
626 
628  ok(handle != NULL,
629  "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
630 
631  SetLastError(0xdeadbeef);
633  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
635  GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
636  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
637  GetLastError());
638 
639  SetLastError(0xdeadbeef);
640  space = 0xdeadbeef;
642  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
643  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
645  GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
646  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
647  GetLastError());
648 
649  SetLastError(0xdeadbeef);
651  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
653  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
654  GetLastError());
655 
656  SetLastError(0xdeadbeef);
657  space = 0xdeadbeef;
659  ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
660  ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
662  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
663  GetLastError());
664 
666  "Expected SetupDestroyDiskSpaceList to succeed\n");
667 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:89
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
Definition: diskspace.c:245
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace, LPCWSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
Definition: diskspace.c:147
int64_t LONGLONG
Definition: typedefs.h:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:417
int ret
#define ERROR_INVALID_DRIVE
Definition: winerror.h:118
static const WCHAR emptyW[]
Definition: navigate.c:40
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:150

Referenced by START_TEST().

Variable Documentation

◆ data

Definition at line 791 of file diskspace.c.

◆ device_length

int device_length

◆ devices

◆ is_win9x

◆ section_test

const { ... } section_test[]

◆ section_test_i

const { ... } section_test_i[]

◆ sections

◆ usage

Definition at line 795 of file diskspace.c.