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.

71 lines
3.0 KiB

  1. #include <windows.h>
  2. #include <winreg.h>
  3. #include <winuser.h>
  4. //#define DEBUG
  5. VOID __cdecl main(){
  6. LONG lDeleteRegResult;
  7. //LPCTSTR tszKeyErrors = TEXT("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Errors");
  8. //LPCTSTR tszKeyMasterInfs = TEXT("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\MasterInfs");
  9. //LPCTSTR tszKeySubcomponents = TEXT("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents");
  10. //LPCTSTR tszKeyTemporaryData = TEXT("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\TemporaryData");
  11. //LPCTSTR tszKeyOCManager = TEXT("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager");
  12. #ifdef DEBUG
  13. HKEY hkeyResult = 0;
  14. // Let's see if I can open the key
  15. lDeleteRegResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Errors", 0, KEY_ALL_ACCESS, &hkeyResult);
  16. if (lDeleteRegResult != ERROR_SUCCESS) {
  17. MessageBox(NULL, TEXT("Can not open error key"), TEXT("Open"), MB_OK);
  18. }
  19. #endif
  20. // Do something to clean OC Manager's registry
  21. // the whole key will be deleted
  22. lDeleteRegResult = RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Errors");
  23. #ifdef DEBUG
  24. if (lDeleteRegResult != ERROR_SUCCESS) {
  25. MessageBox(NULL, TEXT("Error Key not deleted"), TEXT("CleanReg"), MB_OK);
  26. }
  27. #endif
  28. lDeleteRegResult = RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\MasterInfs");
  29. #ifdef DEBUG
  30. if (lDeleteRegResult != ERROR_SUCCESS) {
  31. MessageBox(NULL, TEXT("MasterInfs Key not deleted"), TEXT("CleanReg"), MB_OK);
  32. }
  33. #endif
  34. lDeleteRegResult = RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents");
  35. #ifdef DEBUG
  36. if (lDeleteRegResult != ERROR_SUCCESS) {
  37. MessageBox(NULL, TEXT("Subcomponents Key not deleted"), TEXT("CleanReg"), MB_OK);
  38. }
  39. #endif
  40. lDeleteRegResult = RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\TemporaryData");
  41. #ifdef DEBUG
  42. if (lDeleteRegResult != ERROR_SUCCESS) {
  43. MessageBox(NULL, TEXT("TemporaryData Key not deleted"), TEXT("CleanReg"), MB_OK);
  44. }
  45. #endif
  46. lDeleteRegResult = RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager");
  47. #ifdef DEBUG
  48. if (lDeleteRegResult != ERROR_SUCCESS) {
  49. MessageBox(NULL, TEXT("OCManager Key not deleted"), TEXT("CleanReg"), MB_OK);
  50. }
  51. #endif
  52. lDeleteRegResult = RegFlushKey(HKEY_LOCAL_MACHINE);
  53. #ifdef DEBUG
  54. if (lDeleteRegResult != ERROR_SUCCESS) {
  55. MessageBox(NULL, TEXT("Registry not flushed sucessfully"), TEXT("CleanReg"), MB_OK);
  56. }
  57. #endif
  58. }