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.

55 lines
1.4 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. #include "stdafx.h"
  3. #include "c2cfg.h"
  4. #include "c2cfgDlg.h"
  5. #include "security.h"
  6. extern HKEY g_RegEventKey;
  7. void RegistrySecurityCheck( EVENT_CHECK_TYPE *pRegistryEventCheck )
  8. {
  9. ULONG Status;
  10. Status = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SOFTWARE", 0, KEY_ALL_ACCESS, &g_RegEventKey );
  11. if( Status != ERROR_SUCCESS )
  12. {
  13. // DbgPrint( "Couldn't open registry key\n" );
  14. return;
  15. }
  16. Status = RegNotifyChangeKeyValue( g_RegEventKey,
  17. FALSE,
  18. REG_NOTIFY_CHANGE_SECURITY,
  19. pRegistryEventCheck->handle,
  20. TRUE
  21. );
  22. if( Status != ERROR_SUCCESS )
  23. {
  24. // DbgPrint( "Invalid Reg Handle Created\n" );
  25. return;
  26. }
  27. // DbgPrint( "Created a correct reg handle\n" );
  28. WaitForSingleObject( pRegistryEventCheck->handle, INFINITE );
  29. // DbgPrint( "The registry was touched\n" );
  30. pRegistryEventCheck->bEventTriggered = TRUE;
  31. }
  32. void DirectorySecurityCheck( EVENT_CHECK_TYPE *pDirectoryEventCheck )
  33. {
  34. // DbgPrint( "Created a correct Dir handle\n" );
  35. WaitForSingleObject( pDirectoryEventCheck->handle, INFINITE );
  36. // DbgPrint( "The security of directory c:\\ was changed\n" );
  37. pDirectoryEventCheck->bEventTriggered = TRUE;
  38. }