Source code of Windows XP (NT5)
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.

47 lines
1.0 KiB

  1. #include "pnp.h"
  2. #include "reg.h"
  3. #include "sfstr.h"
  4. #include "misc.h"
  5. #define ARRAYSIZE(a) (sizeof((a))/sizeof((a)[0]))
  6. // Temporary fct to use while PnP team writes the real one
  7. //
  8. // First we look under the DeviceNode for the value and if not there
  9. // we go to the "database".
  10. //
  11. //
  12. HRESULT _GetPropertyHelper(LPCWSTR pszKey, LPCWSTR pszPropName, DWORD* pdwType,
  13. PBYTE pbData, DWORD cbData)
  14. {
  15. HKEY hkey;
  16. HRESULT hr = _RegOpenKey(HKEY_LOCAL_MACHINE, pszKey, &hkey);
  17. if (SUCCEEDED(hr) && (S_FALSE != hr))
  18. {
  19. hr = _RegQueryGenericWithType(hkey, NULL, pszPropName, pdwType,
  20. pbData, cbData);
  21. _RegCloseKey(hkey);
  22. }
  23. return hr;
  24. }
  25. HRESULT _GetPropertySizeHelper(LPCWSTR pszKey, LPCWSTR pszPropName,
  26. DWORD* pcbSize)
  27. {
  28. HKEY hkey;
  29. HRESULT hr = _RegOpenKey(HKEY_LOCAL_MACHINE, pszKey, &hkey);
  30. if (SUCCEEDED(hr) && (S_FALSE != hr))
  31. {
  32. hr = _RegQueryValueSize(hkey, NULL, pszPropName, pcbSize);
  33. _RegCloseKey(hkey);
  34. }
  35. return hr;
  36. }