setupapi: Implement SetupQuerySpaceRequiredOnDriveW.

This commit is contained in:
Andrew Nguyen 2010-09-07 05:00:39 -05:00 committed by Alexandre Julliard
parent 188ed272dc
commit 3902efc9cb
2 changed files with 46 additions and 6 deletions

View File

@ -115,20 +115,26 @@ BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
} }
/*********************************************************************** /***********************************************************************
* SetupQuerySpaceRequiredOnDriveA (SETUPAPI.@) * SetupQuerySpaceRequiredOnDriveW (SETUPAPI.@)
*/ */
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace,
LPCSTR DriveSpec, LONGLONG* SpaceRequired, LPCWSTR DriveSpec, LONGLONG *SpaceRequired,
PVOID Reserved1, UINT Reserved2) PVOID Reserved1, UINT Reserved2)
{ {
WCHAR driveW[20]; WCHAR *driveW;
unsigned int i; unsigned int i;
LPDISKSPACELIST list = DiskSpace; LPDISKSPACELIST list = DiskSpace;
BOOL rc = FALSE; BOOL rc = FALSE;
static const WCHAR bkslsh[]= {'\\',0}; static const WCHAR bkslsh[]= {'\\',0};
MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20); driveW = HeapAlloc(GetProcessHeap(), 0, lstrlenW(DriveSpec) + 2);
if (!driveW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
lstrcpyW(driveW,DriveSpec);
lstrcatW(driveW,bkslsh); lstrcatW(driveW,bkslsh);
TRACE("Looking for drive %s\n",debugstr_w(driveW)); TRACE("Looking for drive %s\n",debugstr_w(driveW));
@ -144,9 +150,43 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
} }
} }
HeapFree(GetProcessHeap(), 0, driveW);
return rc; return rc;
} }
/***********************************************************************
* SetupQuerySpaceRequiredOnDriveA (SETUPAPI.@)
*/
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
LPCSTR DriveSpec, LONGLONG *SpaceRequired,
PVOID Reserved1, UINT Reserved2)
{
LPWSTR DriveSpecW = NULL;
BOOL ret;
if (DriveSpec)
{
DWORD len = MultiByteToWideChar(CP_ACP, 0, DriveSpec, -1, NULL, 0);
DriveSpecW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!DriveSpecW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
MultiByteToWideChar(CP_ACP, 0, DriveSpec, -1, DriveSpecW, len);
}
ret = SetupQuerySpaceRequiredOnDriveW(DiskSpace, DriveSpecW, SpaceRequired,
Reserved1, Reserved2);
HeapFree(GetProcessHeap(), 0, DriveSpecW);
return ret;
}
/*********************************************************************** /***********************************************************************
* SetupDestroyDiskSpaceList (SETUPAPI.@) * SetupDestroyDiskSpaceList (SETUPAPI.@)
*/ */

View File

@ -482,7 +482,7 @@
@ stub SetupQuerySourceListA @ stub SetupQuerySourceListA
@ stub SetupQuerySourceListW @ stub SetupQuerySourceListW
@ stdcall SetupQuerySpaceRequiredOnDriveA(long str ptr ptr long) @ stdcall SetupQuerySpaceRequiredOnDriveA(long str ptr ptr long)
@ stub SetupQuerySpaceRequiredOnDriveW @ stdcall SetupQuerySpaceRequiredOnDriveW(long wstr ptr ptr long)
@ stdcall SetupQueueCopyA(long str str str str str str str long) @ stdcall SetupQueueCopyA(long str str str str str str str long)
@ stdcall SetupQueueCopyIndirectA(ptr) @ stdcall SetupQueueCopyIndirectA(ptr)
@ stdcall SetupQueueCopyIndirectW(ptr) @ stdcall SetupQueueCopyIndirectW(ptr)