Implement SetupDiGetActualSectionToInstallA

Implement SetupDiCreateDeviceInfoA
Add SetupDiCreateDeviceInfoW stub
Fix SetupDiOpenClassRegKeyExW, by adding { } around the GUID string when opening the registry key
Don't use L"..." notation for wide strings

svn path=/trunk/; revision=16391
This commit is contained in:
Hervé Poussineau 2005-07-03 13:46:33 +00:00
parent 89d4545331
commit 5c050fc41f
3 changed files with 133 additions and 12 deletions

View file

@ -39,6 +39,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/* Registry key and value names */
static const WCHAR ControlClass[] = {'S','y','s','t','e','m','\\',
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'C','o','n','t','r','o','l','\\',
'C','l','a','s','s',0};
typedef struct _MACHINE_INFO
{
RPC_BINDING_HANDLE BindingHandle;
@ -166,7 +173,7 @@ CONFIGRET WINAPI CM_Enumerate_Classes_Ex(
rc = RegOpenKeyExW(
hRelativeKey,
L"System\\CurrentControlSet\\Control\\Class",
ControlClass,
0, /* options */
KEY_ENUMERATE_SUB_KEYS,
&hKey);

View file

@ -292,7 +292,7 @@ BOOL WINAPI SetupDiClassGuidsFromNameExA(
LPWSTR MachineNameW = NULL;
BOOL bResult;
FIXME("\n");
TRACE("\n");
ClassNameW = MultiByteToUnicode(ClassName, CP_ACP);
if (ClassNameW == NULL)
@ -630,8 +630,45 @@ BOOL WINAPI SetupDiGetActualSectionToInstallA(
PDWORD RequiredSize,
PSTR *Extension)
{
FIXME("\n");
return FALSE;
LPWSTR InfSectionNameW = NULL;
PWSTR InfSectionWithExtW = NULL;
PWSTR ExtensionW;
BOOL bResult;
TRACE("\n");
if (InfSectionName)
{
InfSectionNameW = MultiByteToUnicode(InfSectionName, CP_ACP);
if (InfSectionNameW == NULL) goto end;
}
if (InfSectionWithExt)
{
InfSectionWithExtW = HeapAlloc(GetProcessHeap(), 0, InfSectionWithExtSize * sizeof(WCHAR));
if (InfSectionWithExtW == NULL) goto end;
}
bResult = SetupDiGetActualSectionToInstallW(InfHandle, InfSectionNameW,
InfSectionWithExt ? InfSectionNameW : NULL,
InfSectionWithExtSize, RequiredSize,
Extension ? &ExtensionW : NULL);
if (InfSectionWithExt)
{
}
if (Extension)
{
if (ExtensionW == NULL)
*Extension = NULL;
else
*Extension = &InfSectionWithExt[ExtensionW - InfSectionWithExtW];
}
end:
if (InfSectionNameW) MyFree(InfSectionNameW);
if (InfSectionWithExtW) HeapFree(GetProcessHeap(), 0, InfSectionWithExtW);
return bResult;
}
/***********************************************************************
@ -1394,6 +1431,8 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
PVOID Reserved)
{
LPWSTR lpGuidString;
LPWSTR lpFullGuidString;
DWORD dwLength;
HKEY hClassesKey;
HKEY hClassKey;
LPCWSTR lpKeyName;
@ -1437,18 +1476,31 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
return INVALID_HANDLE_VALUE;
}
dwLength = lstrlenW(lpGuidString);
lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
if (!lpFullGuidString)
{
RpcStringFreeW(&lpGuidString);
return INVALID_HANDLE_VALUE;
}
lpFullGuidString[0] = '{';
memcpy(&lpFullGuidString[1], lpGuidString, dwLength * sizeof(WCHAR));
lpFullGuidString[dwLength + 1] = '}';
lpFullGuidString[dwLength + 2] = UNICODE_NULL;
RpcStringFreeW(&lpGuidString);
if (RegOpenKeyExW(hClassesKey,
lpGuidString,
lpFullGuidString,
0,
KEY_ALL_ACCESS,
&hClassKey))
{
RpcStringFreeW(&lpGuidString);
HeapFree(GetProcessHeap(), 0, lpFullGuidString);
RegCloseKey(hClassesKey);
return INVALID_HANDLE_VALUE;
}
RpcStringFreeW(&lpGuidString);
HeapFree(GetProcessHeap(), 0, lpFullGuidString);
RegCloseKey(hClassesKey);
return hClassKey;
@ -1535,3 +1587,65 @@ HKEY WINAPI SetupDiOpenDevRegKey(
Scope, HwProfile, KeyType, samDesired);
return INVALID_HANDLE_VALUE;
}
/***********************************************************************
* SetupDiCreateDeviceInfoA (SETUPAPI.@)
*/
BOOL WINAPI SetupDiCreateDeviceInfoA(
HDEVINFO DeviceInfoSet,
PCSTR DeviceName,
LPGUID ClassGuid,
PCSTR DeviceDescription,
HWND hwndParent,
DWORD CreationFlags,
PSP_DEVINFO_DATA DeviceInfoData)
{
LPWSTR DeviceNameW = NULL;
LPWSTR DeviceDescriptionW = NULL;
BOOL bResult;
TRACE("\n");
if (DeviceName)
{
DeviceNameW = MultiByteToUnicode(DeviceName, CP_ACP);
if (DeviceNameW == NULL) return FALSE;
}
if (DeviceDescription)
{
DeviceDescriptionW = MultiByteToUnicode(DeviceDescription, CP_ACP);
if (DeviceDescriptionW == NULL)
{
if (DeviceNameW) MyFree(DeviceNameW);
return FALSE;
}
}
bResult = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW,
ClassGuid, DeviceDescriptionW,
hwndParent, CreationFlags,
DeviceInfoData);
if (DeviceNameW) MyFree(DeviceNameW);
if (DeviceDescriptionW) MyFree(DeviceDescriptionW);
return bResult;
}
/***********************************************************************
* SetupDiCreateDeviceInfoW (SETUPAPI.@)
*/
BOOL WINAPI SetupDiCreateDeviceInfoW(
HDEVINFO DeviceInfoSet,
PCWSTR DeviceName,
LPGUID ClassGuid,
PCWSTR DeviceDescription,
HWND hwndParent,
DWORD CreationFlags,
PSP_DEVINFO_DATA DeviceInfoData)
{
FIXME("%p %S %p %S %p %lx %p\n", DeviceInfoSet, debugstr_w(DeviceName),
ClassGuid, debugstr_w(DeviceDescription), hwndParent,
CreationFlags, DeviceInfoData);
return FALSE;
}

View file

@ -38,8 +38,8 @@
@ stub CM_Dup_Range_List
@ stub CM_Enable_DevNode
@ stub CM_Enable_DevNode_Ex
@ stub CM_Enumerate_Classes
@ stub CM_Enumerate_Classes_Ex
@ stdcall CM_Enumerate_Classes(long ptr long)
@ stdcall CM_Enumerate_Classes_Ex(long ptr long ptr)
@ stub CM_Enumerate_EnumeratorsA
@ stub CM_Enumerate_EnumeratorsW
@ stub CM_Enumerate_Enumerators_ExA
@ -282,11 +282,11 @@
@ stdcall SetupDiClassNameFromGuidW(ptr wstr long ptr)
@ stub SetupDiCreateDevRegKeyA
@ stub SetupDiCreateDevRegKeyW
@ stub SetupDiCreateDeviceInfoA
@ stdcall SetupDiCreateDeviceInfoA(ptr str ptr str ptr long ptr)
@ stdcall SetupDiCreateDeviceInfoW(ptr wstr ptr wstr ptr long ptr)
@ stdcall SetupDiCreateDeviceInfoList(ptr ptr)
@ stdcall SetupDiCreateDeviceInfoListExA(ptr long str ptr)
@ stdcall SetupDiCreateDeviceInfoListExW(ptr long str ptr)
@ stub SetupDiCreateDeviceInfoW
@ stdcall SetupDiCreateDeviceInfoListExW(ptr long wstr ptr)
@ stub SetupDiDeleteDevRegKey
@ stub SetupDiDeleteDeviceInfo
@ stub SetupDiDeleteDeviceInterfaceData