A beginning on Setup.*DiskSpace functions
Aric Stewart
aric at codeweavers.com
Tue Mar 16 13:38:39 CST 2004
Beginnings on implementations of SetupCreateDiskSpaceListWA,
SetupAddInstallSectionToDiskSpaceListA, SetupQuerySpaceRequiredOnDriveA
and SetupDestroyDiskSpaceList for MDAC install.
liscence LGPL
-------------- next part --------------
Index: dlls/setupapi/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/Makefile.in,v
retrieving revision 1.24
diff -u -w -r1.24 Makefile.in
--- dlls/setupapi/Makefile.in 21 Oct 2003 23:45:43 -0000 1.24
+++ dlls/setupapi/Makefile.in 16 Mar 2004 19:35:09 -0000
@@ -17,7 +17,8 @@
parser.c \
queue.c \
setupcab.c \
- stubs.c
+ stubs.c\
+ diskspace.c
C_SRCS16 = \
devinst16.c \
Index: dlls/setupapi/setupapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/setupapi.spec,v
retrieving revision 1.27
diff -u -w -r1.27 setupapi.spec
--- dlls/setupapi/setupapi.spec 16 Mar 2004 19:13:18 -0000 1.27
+++ dlls/setupapi/setupapi.spec 16 Mar 2004 19:35:09 -0000
@@ -50,7 +50,7 @@
@ stub RetrieveServiceConfig
@ stub SearchForInfFile
@ stub SetArrayToMultiSzValue
-@ stub SetupAddInstallSectionToDiskSpaceListA
+@ stdcall SetupAddInstallSectionToDiskSpaceListA(ptr ptr ptr str ptr long)
@ stub SetupAddInstallSectionToDiskSpaceListW
@ stub SetupAddSectionToDiskSpaceListA
@ stub SetupAddSectionToDiskSpaceListW
@@ -70,8 +70,8 @@
@ stub SetupCopyErrorW
@ stdcall SetupCopyOEMInfA(str str long long ptr long ptr ptr)
@ stub SetupCopyOEMInfW
-@ stdcall SetupCreateDiskSpaceListA(ptr long long)
-@ stdcall SetupCreateDiskSpaceListW(ptr long long)
+@ stdcall SetupCreateDiskSpaceListA(ptr long long) SetupCreateDiskSpaceListWA
+@ stdcall SetupCreateDiskSpaceListW(ptr long long) SetupCreateDiskSpaceListWA
@ stub SetupDecompressOrCopyFileA
@ stub SetupDecompressOrCopyFileW
@ stub SetupDefaultQueueCallback
@@ -79,7 +79,7 @@
@ stdcall SetupDefaultQueueCallbackW(ptr long long long)
@ stub SetupDeleteErrorA
@ stub SetupDeleteErrorW
-@ stub SetupDestroyDiskSpaceList
+@ stdcall SetupDestroyDiskSpaceList(ptr)
@ stub SetupDiAskForOEMDisk
@ stub SetupDiBuildClassInfoList
@ stdcall SetupDiBuildClassInfoListExW(long ptr long ptr wstr ptr)
@@ -254,7 +254,7 @@
@ stub SetupQueryInfOriginalFileInformationW
@ stub SetupQuerySourceListA
@ stub SetupQuerySourceListW
-@ stub SetupQuerySpaceRequiredOnDriveA
+@ stdcall SetupQuerySpaceRequiredOnDriveA(ptr str ptr ptr long)
@ stub SetupQuerySpaceRequiredOnDriveW
@ stdcall SetupQueueCopyA(long str str str str str str str long)
@ stdcall SetupQueueCopyIndirectA(ptr)
Index: dlls/setupapi/stubs.c
===================================================================
RCS file: /home/wine/wine/dlls/setupapi/stubs.c,v
retrieving revision 1.21
diff -u -w -r1.21 stubs.c
--- dlls/setupapi/stubs.c 16 Mar 2004 19:13:18 -0000 1.21
+++ dlls/setupapi/stubs.c 16 Mar 2004 19:35:09 -0000
@@ -201,24 +201,6 @@
}
/***********************************************************************
- * SetupCreateDiskSpaceListA (SETUPAPI.@)
- */
-HDSKSPC SetupCreateDiskSpaceListA( PVOID Reserved1, DWORD Reserved2, UINT Flags )
-{
- FIXME("%08x\n", Flags);
- return NULL;
-}
-
-/***********************************************************************
- * SetupCreateDiskSpaceListA (SETUPAPI.@)
- */
-HDSKSPC SetupCreateDiskSpaceListW( PVOID Reserved1, DWORD Reserved2, UINT Flags )
-{
- FIXME("%08x\n", Flags);
- return NULL;
-}
-
-/***********************************************************************
* SetupInitializeFileLogW(SETUPAPI.@)
*/
HANDLE WINAPI SetupInitializeFileLogW(LPWSTR LogFileName, DWORD Flags)
--- /dev/null Thu Aug 30 15:30:55 2001
+++ dlls/setupapi/diskspace.c Tue Mar 16 13:34:55 2004
@@ -0,0 +1,143 @@
+/*
+ * SetupAPI DiskSpace functions
+ *
+ * Copyright 2004 Codeweavers (Aric Stewart)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdarg.h>
+
+#include "wine/debug.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winnls.h"
+#include "winreg.h"
+#include "setupapi.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
+
+typedef struct {
+ WCHAR lpzName[20];
+ LONGLONG dwFreeSpace;
+ LONGLONG dwWantedSpace;
+} DRIVE_ENTRY, *LPDRIVE_ENTRY;
+
+typedef struct {
+ DWORD dwDriveCount;
+ DRIVE_ENTRY Drives[26];
+} DISKSPACELIST, *LPDISKSPACELIST;
+
+/***********************************************************************
+ * SetupCreateDiskSpaceListWA(SETUPAPI.@)
+ */
+HDSKSPC WINAPI SetupCreateDiskSpaceListWA(PVOID Reserved1, DWORD Reserved2,
+ UINT Flags)
+{
+ WCHAR drives[255];
+ DWORD rc;
+ WCHAR *ptr;
+ LPDISKSPACELIST list=NULL;
+
+ rc = GetLogicalDriveStringsW(255,drives);
+
+ if (rc == 0)
+ return NULL;
+
+ list = (LPDISKSPACELIST)HeapAlloc(GetProcessHeap(),0,sizeof(DISKSPACELIST));
+
+ list->dwDriveCount = 0;
+
+ ptr = drives;
+
+ while (*ptr)
+ {
+ DWORD type = GetDriveTypeW(ptr);
+ DWORD len;
+ if (type == DRIVE_FIXED)
+ {
+ DWORD clusters;
+ DWORD sectors;
+ DWORD bytes;
+ DWORD total;
+ lstrcpyW(list->Drives[list->dwDriveCount].lpzName,ptr);
+ GetDiskFreeSpaceW(ptr,§ors,&bytes,&clusters,&total);
+ list->Drives[list->dwDriveCount].dwFreeSpace = clusters * sectors *
+ bytes;
+ list->Drives[list->dwDriveCount].dwWantedSpace = 0;
+ list->dwDriveCount++;
+ }
+ len = lstrlenW(ptr);
+ len++;
+ ptr+=sizeof(WCHAR)*len;
+ }
+ return (HANDLE)list;
+}
+
+/***********************************************************************
+ * SetupAddInstallSectionToDiskSpaceListA(SETUPAPI.@)
+ */
+BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
+ HINF InfHandle, HINF LayoutInfHandle,
+ LPSTR SectionName, PVOID Reserved1, UINT Reserved2)
+{
+ FIXME ("Stub\n");
+ return TRUE;
+}
+
+/***********************************************************************
+* SetupAddInstallSectionToDiskSpaceListA(SETUPAPI.@)
+*/
+BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
+ LPSTR DriveSpec, LONGLONG* SpaceRequired,
+ PVOID Reserved1, UINT Reserved2)
+{
+ WCHAR driveW[20];
+ int i;
+ LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
+ BOOL rc = FALSE;
+ WCHAR bkslsh[]= {'\\',0};
+
+ MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20);
+
+ lstrcatW(driveW,bkslsh);
+
+ TRACE("Looking for drive %s\n",debugstr_w(driveW));
+
+ for (i = 0; i < list->dwDriveCount; i++)
+ {
+ TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
+ if (lstrcmpW(driveW,list->Drives[i].lpzName)==0)
+ {
+ rc = TRUE;
+ *SpaceRequired = list->Drives[i].dwWantedSpace;
+ break;
+ }
+ }
+
+ return rc;
+}
+
+/***********************************************************************
+* SetupDestroyDiskSpaceList(SETUPAPI.@)
+*/
+BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
+{
+ LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
+ HeapFree(GetProcessHeap(),0,list);
+ return TRUE;
+}
More information about the wine-patches
mailing list