From ffbb75fe2554eb4cc0f7313a33c3812b627c6f85 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 17 Mar 2004 01:46:00 +0000 Subject: [PATCH] Beginnings on implementations of SetupCreateDiskSpaceListA/W, SetupQuerySpaceRequiredOnDriveA, SetupDestroyDiskSpaceList and SetupAddInstallSectionToDiskSpaceListA for MDAC install. --- dlls/setupapi/Makefile.in | 1 + dlls/setupapi/diskspace.c | 153 ++++++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/setupapi.spec | 6 +- dlls/setupapi/stubs.c | 18 ------ 4 files changed, 157 insertions(+), 21 deletions(-) create mode 100644 dlls/setupapi/diskspace.c diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in index 198ddafecfc..df4fea256e5 100644 --- a/dlls/setupapi/Makefile.in +++ b/dlls/setupapi/Makefile.in @@ -13,6 +13,7 @@ SPEC_SRCS16 = $(ALTNAMES:.dll=.spec) C_SRCS = \ devinst.c \ dirid.c \ + diskspace.c \ install.c \ parser.c \ queue.c \ diff --git a/dlls/setupapi/diskspace.c b/dlls/setupapi/diskspace.c new file mode 100644 index 00000000000..965df5c8447 --- /dev/null +++ b/dlls/setupapi/diskspace.c @@ -0,0 +1,153 @@ +/* + * 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 + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winreg.h" +#include "setupapi.h" +#include "wine/debug.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; + + +/*********************************************************************** + * SetupCreateDiskSpaceListW (SETUPAPI.@) + */ +HDSKSPC WINAPI SetupCreateDiskSpaceListW(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; +} + + +/*********************************************************************** + * SetupCreateDiskSpaceListA (SETUPAPI.@) + */ +HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags) +{ + return SetupCreateDiskSpaceListW( Reserved1, Reserved2, Flags ); +} + + +/*********************************************************************** + * SetupAddInstallSectionToDiskSpaceListA (SETUPAPI.@) + */ +BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace, + HINF InfHandle, HINF LayoutInfHandle, + LPSTR SectionName, PVOID Reserved1, UINT Reserved2) +{ + FIXME ("Stub\n"); + return TRUE; +} + +/*********************************************************************** +* SetupQuerySpaceRequiredOnDriveA (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; +} diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 7f8437cfb49..6f5413d1a30 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -50,7 +50,7 @@ @ stub RetrieveServiceConfig @ stub SearchForInfFile @ stub SetArrayToMultiSzValue -@ stub SetupAddInstallSectionToDiskSpaceListA +@ stdcall SetupAddInstallSectionToDiskSpaceListA(long long long str ptr long) @ stub SetupAddInstallSectionToDiskSpaceListW @ stub SetupAddSectionToDiskSpaceListA @ stub SetupAddSectionToDiskSpaceListW @@ -79,7 +79,7 @@ @ stdcall SetupDefaultQueueCallbackW(ptr long long long) @ stub SetupDeleteErrorA @ stub SetupDeleteErrorW -@ stub SetupDestroyDiskSpaceList +@ stdcall SetupDestroyDiskSpaceList(long) @ 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(long str ptr ptr long) @ stub SetupQuerySpaceRequiredOnDriveW @ stdcall SetupQueueCopyA(long str str str str str str str long) @ stdcall SetupQueueCopyIndirectA(ptr) diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index ddb0a435da7..8465b35f9fa 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -201,24 +201,6 @@ BOOL WINAPI SetupGetInfInformationA( LPCVOID InfSpec, DWORD SearchControl, } /*********************************************************************** - * 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) -- 2.11.4.GIT