Louis. Lenders wrote:
> diff --git a/dlls/advapi32/Makefile.in b/dlls/advapi32/Makefile.in
> index 1b4cf5b..da7aec4 100644
> --- a/dlls/advapi32/Makefile.in
> +++ b/dlls/advapi32/Makefile.in
> @@ -5,7 +5,7 @@ SRCDIR = @srcdir@
> VPATH = @srcdir@
> MODULE = advapi32.dll
> IMPORTLIB = libadvapi32.$(IMPLIBEXT)
> -IMPORTS = kernel32 ntdll
> +IMPORTS = kernel32 ntdll rpcrt4
>
Please make this a DELAYIMPORTS if you have to import a function from
rpcrt4.
>
> C_SRCS = \
> advapi.c \
> diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c
> index 04a520a..fd2f576 100644
> --- a/dlls/advapi32/advapi.c
> +++ b/dlls/advapi32/advapi.c
> @@ -33,6 +33,7 @@ #include "winreg.h"
> #include "winternl.h"
> #include "winerror.h"
> #include "appmgmt.h"
> +#include "rpc.h"
>
> #include "wine/library.h"
> #include "wine/debug.h"
> @@ -116,11 +117,54 @@ GetUserNameW( LPWSTR lpszName, LPDWORD l
> */
> BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA pInfo)
> {
> - FIXME("(%p) semi-stub\n", pInfo);
> - pInfo->dwDockInfo = DOCKINFO_DOCKED;
> - strcpy(pInfo->szHwProfileGuid,"{12340001-1234-1234-1234-1233456789012}");
> - strcpy(pInfo->szHwProfileName,"Wine Profile");
> - return 1;
> + UUID __RPC_FAR* Uuid=0;
> + HKEY hkey;
> + DWORD size;
> + DWORD dockingstate = 0x00000000;
> + CHAR profilename[] = "Wine Profile";
> +
> + RegCreateKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001", &hkey);
> +
> + size = HW_PROFILE_GUIDLEN;
> + /*If the ProfileGuid is not in the registry, create it, and write it to the registry*/
> + if(ERROR_SUCCESS != RegGetValueA(hkey, 0, "HwProfileGuid", RRF_RT_REG_SZ, 0, pInfo->szHwProfileGuid, &size))
> + {
> + Uuid = HeapAlloc(GetProcessHeap(), 0, sizeof(*Uuid));
>
You don't need to allocate memory for this variable.
> +
> + if(RPC_S_OK != UuidCreate(Uuid))
> + {
> + ERR("UuidCreate failed to create a UUID");
> + HeapFree( GetProcessHeap(), 0, Uuid );
> + return FALSE;
> + }
> +
> + RegSetValueExA(hkey, "HwProfileGuid", 0, REG_SZ, (const BYTE*) debugstr_guid(Uuid), strlen(debugstr_guid(Uuid)));
>
You shouldn't be using a debugging command for formating a GUID to a
string, as the function could change its output later on and break this
function.
> + }
> +
> + RegGetValueA(hkey, 0, "HwProfileGuid", RRF_RT_REG_SZ, 0, pInfo->szHwProfileGuid, &size);
> + HeapFree( GetProcessHeap(), 0, Uuid );
> +
> + size = MAX_PROFILE_LEN;
> + /*If the ProfileName is not in the registry create it, and write to the registry*/
> + if(ERROR_SUCCESS != RegGetValueA(hkey, 0, "FriendlyName", RRF_RT_REG_SZ, 0, pInfo->szHwProfileName, &size))
> + RegSetValueExA(hkey, "FriendlyName", 0, REG_SZ, (const BYTE*) profilename, sizeof(profilename));
> + RegGetValueA(hkey, 0, "FriendlyName", RRF_RT_REG_SZ, 0, pInfo->szHwProfileName, &size);
> +
> + RegCloseKey(hkey);
> +
> + RegCreateKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\IDConfigDB\\CurrentDockInfo", &hkey);
> +
> + size = sizeof(DWORD);
> + /*If the DockingState is not in the registry create it, and write to the registry*/
> + if(ERROR_SUCCESS != RegGetValueA(hkey, 0, "DockingState", RRF_RT_DWORD , 0, &pInfo->dwDockInfo, &size))
> + RegSetValueExA(hkey, "DockingState", 0, REG_DWORD, (const BYTE*) &dockingstate, sizeof(DWORD));
> + RegGetValueA(hkey, 0, "DockingState", RRF_RT_DWORD, 0, &pInfo->dwDockInfo, &size);
> +
> + RegCloseKey(hkey);
> +
> + TRACE("DockInfo = %x, Profile Guid = %s, Friendly Name = %s\n", pInfo->dwDockInfo, pInfo->szHwProfileGuid, pInfo->szHwProfileName);
> +
> + return 1;
> }
>
> /******************************************************************************
>
You could also do with some error checking here.
--
Rob Shearman