ReactOS  0.4.13-dev-73-gcfe54aa
diskspace.c File Reference
#include "setupapi_private.h"
Include dependency graph for diskspace.c:

Go to the source code of this file.

Classes

struct  DRIVE_ENTRY
 
struct  DISKSPACELIST
 

Typedefs

typedef struct DRIVE_ENTRYLPDRIVE_ENTRY
 
typedef struct DISKSPACELISTLPDISKSPACELIST
 

Functions

HDSKSPC WINAPI SetupCreateDiskSpaceListW (PVOID Reserved1, DWORD Reserved2, UINT Flags)
 
HDSKSPC WINAPI SetupCreateDiskSpaceListA (PVOID Reserved1, DWORD Reserved2, UINT Flags)
 
HDSKSPC WINAPI SetupDuplicateDiskSpaceListW (HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags)
 
HDSKSPC WINAPI SetupDuplicateDiskSpaceListA (HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags)
 
BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA (HDSKSPC DiskSpace, HINF InfHandle, HINF LayoutInfHandle, LPCSTR SectionName, PVOID Reserved1, UINT Reserved2)
 
BOOL WINAPI SetupQuerySpaceRequiredOnDriveW (HDSKSPC DiskSpace, LPCWSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
 
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA (HDSKSPC DiskSpace, LPCSTR DriveSpec, LONGLONG *SpaceRequired, PVOID Reserved1, UINT Reserved2)
 
BOOL WINAPI SetupDestroyDiskSpaceList (HDSKSPC DiskSpace)
 
BOOL WINAPI SetupAddToDiskSpaceListA (HDSKSPC diskspace, PCSTR targetfile, LONGLONG filesize, UINT operation, PVOID reserved1, UINT reserved2)
 
BOOL WINAPI SetupAddToDiskSpaceListW (HDSKSPC diskspace, PCWSTR targetfile, LONGLONG filesize, UINT operation, PVOID reserved1, UINT reserved2)
 

Typedef Documentation

◆ LPDISKSPACELIST

◆ LPDRIVE_ENTRY

Function Documentation

◆ SetupAddInstallSectionToDiskSpaceListA()

BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA ( HDSKSPC  DiskSpace,
HINF  InfHandle,
HINF  LayoutInfHandle,
LPCSTR  SectionName,
PVOID  Reserved1,
UINT  Reserved2 
)

Definition at line 136 of file diskspace.c.

139 {
140  FIXME ("Stub\n");
141  return TRUE;
142 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110

Referenced by test_SetupAddInstallSectionToDiskSpaceListA().

◆ SetupAddToDiskSpaceListA()

BOOL WINAPI SetupAddToDiskSpaceListA ( HDSKSPC  diskspace,
PCSTR  targetfile,
LONGLONG  filesize,
UINT  operation,
PVOID  reserved1,
UINT  reserved2 
)

Definition at line 255 of file diskspace.c.

258 {
259  FIXME(": stub\n");
261  return FALSE;
262 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

Referenced by test_SetupAddToDiskSpaceListA(), test_SetupQueryDrivesInDiskSpaceListA(), and test_SetupQuerySpaceRequiredOnDriveA().

◆ SetupAddToDiskSpaceListW()

BOOL WINAPI SetupAddToDiskSpaceListW ( HDSKSPC  diskspace,
PCWSTR  targetfile,
LONGLONG  filesize,
UINT  operation,
PVOID  reserved1,
UINT  reserved2 
)

Definition at line 267 of file diskspace.c.

270 {
271  FIXME(": stub\n");
273  return FALSE;
274 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SetupCreateDiskSpaceListA()

HDSKSPC WINAPI SetupCreateDiskSpaceListA ( PVOID  Reserved1,
DWORD  Reserved2,
UINT  Flags 
)

◆ SetupCreateDiskSpaceListW()

HDSKSPC WINAPI SetupCreateDiskSpaceListW ( PVOID  Reserved1,
DWORD  Reserved2,
UINT  Flags 
)

Definition at line 38 of file diskspace.c.

39 {
40  WCHAR drives[255];
41  DWORD rc;
42  WCHAR *ptr;
44 
45  TRACE("(%p, %u, 0x%08x)\n", Reserved1, Reserved2, Flags);
46 
48  {
50  return NULL;
51  }
52 
53  rc = GetLogicalDriveStringsW(255,drives);
54 
55  if (rc == 0)
56  return NULL;
57 
59 
60  list->dwDriveCount = 0;
61 
62  ptr = drives;
63 
64  while (*ptr)
65  {
67  if (type == DRIVE_FIXED)
68  {
69  DWORD clusters;
70  DWORD sectors;
71  DWORD bytes;
72  DWORD total;
73  lstrcpyW(list->Drives[list->dwDriveCount].lpzName,ptr);
74  GetDiskFreeSpaceW(ptr,&sectors,&bytes,&clusters,&total);
75  list->Drives[list->dwDriveCount].dwFreeSpace = clusters * sectors *
76  bytes;
77  list->Drives[list->dwDriveCount].dwWantedSpace = 0;
78  list->dwDriveCount++;
79  }
80  ptr += lstrlenW(ptr) + 1;
81  }
82  return list;
83 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SPDSL_IGNORE_DISK
Definition: setupapi.h:538
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
Definition: bcd.h:202
BOOL WINAPI GetDiskFreeSpaceW(IN LPCWSTR lpRootPathName, OUT LPDWORD lpSectorsPerCluster, OUT LPDWORD lpBytesPerSector, OUT LPDWORD lpNumberOfFreeClusters, OUT LPDWORD lpTotalNumberOfClusters)
Definition: disk.c:173
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
Definition: _list.h:228
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_FIXED
Definition: winbase.h:249
#define lstrcpyW
Definition: compat.h:406
#define list
Definition: rosglue.h:35
__u8 sectors[2]
Definition: mkdosfs.c:366
Definition: bcd.h:201
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73

Referenced by SetupCreateDiskSpaceListA(), START_TEST(), test_SetupCreateDiskSpaceListW(), and test_SetupDuplicateDiskSpaceListW().

◆ SetupDestroyDiskSpaceList()

◆ SetupDuplicateDiskSpaceListA()

HDSKSPC WINAPI SetupDuplicateDiskSpaceListA ( HDSKSPC  DiskSpace,
PVOID  Reserved1,
DWORD  Reserved2,
UINT  Flags 
)

Definition at line 128 of file diskspace.c.

129 {
131 }
HDSKSPC WINAPI SetupDuplicateDiskSpaceListW(HDSKSPC DiskSpace, PVOID Reserved1, DWORD Reserved2, UINT Flags)
Definition: diskspace.c:97
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
Definition: bcd.h:202
Definition: bcd.h:201

Referenced by test_SetupDuplicateDiskSpaceListA().

◆ SetupDuplicateDiskSpaceListW()

HDSKSPC WINAPI SetupDuplicateDiskSpaceListW ( HDSKSPC  DiskSpace,
PVOID  Reserved1,
DWORD  Reserved2,
UINT  Flags 
)

Definition at line 97 of file diskspace.c.

98 {
99  DISKSPACELIST *list_copy, *list_original = DiskSpace;
100 
101  if (Reserved1 || Reserved2 || Flags)
102  {
104  return NULL;
105  }
106 
107  if (!DiskSpace)
108  {
110  return NULL;
111  }
112 
113  list_copy = HeapAlloc(GetProcessHeap(), 0, sizeof(DISKSPACELIST));
114  if (!list_copy)
115  {
117  return NULL;
118  }
119 
120  *list_copy = *list_original;
121 
122  return list_copy;
123 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
Definition: bcd.h:202
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:409
Definition: bcd.h:201

Referenced by SetupDuplicateDiskSpaceListA(), and test_SetupDuplicateDiskSpaceListW().

◆ SetupQuerySpaceRequiredOnDriveA()

BOOL WINAPI SetupQuerySpaceRequiredOnDriveA ( HDSKSPC  DiskSpace,
LPCSTR  DriveSpec,
LONGLONG SpaceRequired,
PVOID  Reserved1,
UINT  Reserved2 
)

Definition at line 201 of file diskspace.c.

204 {
205  DWORD len;
206  LPWSTR DriveSpecW;
207  BOOL ret;
208 
209  /* The parameter validation checks are in a different order from the
210  * Unicode variant of SetupQuerySpaceRequiredOnDrive. */
211  if (!DriveSpec)
212  {
214  return FALSE;
215  }
216 
217  if (!DiskSpace)
218  {
220  return FALSE;
221  }
222 
223  len = MultiByteToWideChar(CP_ACP, 0, DriveSpec, -1, NULL, 0);
224 
225  DriveSpecW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
226  if (!DriveSpecW)
227  {
229  return FALSE;
230  }
231 
232  MultiByteToWideChar(CP_ACP, 0, DriveSpec, -1, DriveSpecW, len);
233 
234  ret = SetupQuerySpaceRequiredOnDriveW(DiskSpace, DriveSpecW, SpaceRequired,
236 
237  HeapFree(GetProcessHeap(), 0, DriveSpecW);
238 
239  return ret;
240 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CP_ACP
Definition: compat.h:99
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
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
Definition: bcd.h:202
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
Definition: bcd.h:201
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_SetupAddInstallSectionToDiskSpaceListA(), test_SetupAddSectionToDiskSpaceListA(), and test_SetupQuerySpaceRequiredOnDriveA().

◆ SetupQuerySpaceRequiredOnDriveW()

BOOL WINAPI SetupQuerySpaceRequiredOnDriveW ( HDSKSPC  DiskSpace,
LPCWSTR  DriveSpec,
LONGLONG SpaceRequired,
PVOID  Reserved1,
UINT  Reserved2 
)

Definition at line 147 of file diskspace.c.

150 {
151  WCHAR *driveW;
152  unsigned int i;
153  LPDISKSPACELIST list = DiskSpace;
154  BOOL rc = FALSE;
155  static const WCHAR bkslsh[]= {'\\',0};
156 
157  if (!DiskSpace)
158  {
160  return FALSE;
161  }
162 
163  if (!DriveSpec)
164  {
166  return FALSE;
167  }
168 
169  driveW = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(DriveSpec) + 2) * sizeof(WCHAR));
170  if (!driveW)
171  {
173  return FALSE;
174  }
175 
176  lstrcpyW(driveW,DriveSpec);
177  lstrcatW(driveW,bkslsh);
178 
179  TRACE("Looking for drive %s\n",debugstr_w(driveW));
180 
181  for (i = 0; i < list->dwDriveCount; i++)
182  {
183  TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
184  if (lstrcmpW(driveW,list->Drives[i].lpzName)==0)
185  {
186  rc = TRUE;
187  *SpaceRequired = list->Drives[i].dwWantedSpace;
188  break;
189  }
190  }
191 
192  HeapFree(GetProcessHeap(), 0, driveW);
193 
195  return rc;
196 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define lstrlenW
Definition: compat.h:407
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
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_INVALID_DRIVE
Definition: winerror.h:118
Definition: _list.h:228
#define lstrcpyW
Definition: compat.h:406
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by SetupQuerySpaceRequiredOnDriveA(), and test_SetupQuerySpaceRequiredOnDriveW().