Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

  1. /*
  2. RegThunk.c
  3. Created by Lee Hart, 4/27/95
  4. Purpose: Generic Thunks to Win32 Registry APIs that are not
  5. supported in Win16
  6. */
  7. #include <windows.h>
  8. #include <shellapi.h>
  9. #include <wownt16.h>
  10. #ifndef CHAR
  11. #define CHAR char
  12. #endif // ifndef CHAR
  13. #include "regporte.h"
  14. LONG RegSetValueEx(
  15. HKEY hKey, // handle of key to set value for
  16. LPCSTR lpValueName, // address of value to set
  17. DWORD Reserved, // reserved
  18. DWORD dwType, // flag for value type
  19. CONST BYTE FAR * lpData, // address of value data
  20. DWORD cbData // size of value data
  21. )
  22. {
  23. DWORD hAdvApi32=LoadLibraryEx32W("ADVAPI32.DLL", NULL, 0);
  24. DWORD pFn;
  25. DWORD dwResult = ERROR_ACCESS_DENIED; //random error if fail
  26. if ((DWORD)0!=hAdvApi32)
  27. {
  28. pFn=GetProcAddress32W(hAdvApi32, "RegSetValueExA"); // call ANSI version
  29. if ((DWORD)0!=pFn)
  30. {
  31. dwResult=CallProcEx32W( CPEX_DEST_STDCALL | 6, 0x12, pFn, hKey, lpValueName, Reserved, dwType, lpData, cbData );
  32. }
  33. }
  34. if (hAdvApi32) FreeLibrary32W(hAdvApi32);
  35. return(dwResult);
  36. }