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.

111 lines
2.9 KiB

  1. /*
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. CUSeeMe4.cpp
  5. Abstract:
  6. This DLL fixes a profiles bug in CU-SeeMe Pro 4.0 setup where it only adds some certain
  7. Reg values to the per-user hive (HKCU) instead of putting them in HKLM.
  8. We don't actually hook any functions, instead, we just copy the regkeys after setup finishes
  9. when our process detach is called.
  10. Notes:
  11. History:
  12. 08/07/2000 reinerf Created
  13. 11/29/2000 andyseti Renamed file from setup.cpp into CUSeeMe4.cpp.
  14. Converted into AppSpecific shim.
  15. */
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(CUSeeMe4)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_END
  21. BOOL
  22. NOTIFY_FUNCTION(
  23. DWORD fdwReason)
  24. {
  25. if (fdwReason == DLL_PROCESS_DETACH)
  26. {
  27. HKEY hkCU;
  28. HKEY hkLM;
  29. if ((RegOpenKeyExA(HKEY_CURRENT_USER,
  30. "Software\\White Pine\\CU-SeeMe Pro\\4.0\\Installer",
  31. 0,
  32. KEY_QUERY_VALUE,
  33. &hkCU) == ERROR_SUCCESS))
  34. {
  35. if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
  36. "Software\\White Pine\\CU-SeeMe Pro\\4.0\\Installer",
  37. 0,
  38. KEY_SET_VALUE,
  39. &hkLM) == ERROR_SUCCESS)
  40. {
  41. // these are the values we want to migrate
  42. static char* aszValues[] = {"Folder",
  43. "Serial",
  44. "Help",
  45. 0,
  46. };
  47. char** ppszValue = aszValues;
  48. LOGN( eDbgLevelError,
  49. "Copying values from 'HKCU\\Software\\White Pine\\CU-SeeMe Pro\\4.0\\Installer' into"
  50. "'HKLM\\Software\\White Pine\\CU-SeeMe Pro\\4.0\\Installer'.");
  51. while (*ppszValue)
  52. {
  53. DWORD dwType;
  54. DWORD cbData;
  55. char szData[MAX_PATH];
  56. cbData = sizeof(szData);
  57. if (RegQueryValueExA(hkCU,
  58. *ppszValue,
  59. NULL,
  60. &dwType,
  61. (LPBYTE)&szData,
  62. &cbData) == ERROR_SUCCESS)
  63. {
  64. RegSetValueExA(hkLM, *ppszValue, 0, dwType, (LPBYTE)&szData, cbData);
  65. }
  66. // get the next value to migrate from hkcu -> hklm
  67. ppszValue++;
  68. }
  69. RegCloseKey(hkLM);
  70. }
  71. RegCloseKey(hkCU);
  72. }
  73. }
  74. return TRUE;
  75. }
  76. /*++
  77. Register hooked functions
  78. --*/
  79. HOOK_BEGIN
  80. CALL_NOTIFY_FUNCTION
  81. HOOK_END
  82. IMPLEMENT_SHIM_END