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.

70 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. PrintMaster4.cpp
  5. Abstract:
  6. Force mfcans32.dll to not have the read-only bit. Many HP systems shipped
  7. with this turned on as a kind of lightweight SFP. However, the unpleasant
  8. consequence is that PrintMaster doesn't install.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 02/20/2002 linstev Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(PrintMaster4)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_END
  19. /*++
  20. Run Notify function only
  21. --*/
  22. BOOL
  23. NOTIFY_FUNCTION(
  24. DWORD fdwReason)
  25. {
  26. if (fdwReason == DLL_PROCESS_ATTACH) {
  27. CSTRING_TRY
  28. {
  29. CString csFileName;
  30. csFileName.GetSystemDirectory();
  31. csFileName += L"\\mfcans32.dll";
  32. DWORD dwAttr = GetFileAttributesW(csFileName);
  33. // Remove the read-only
  34. if (dwAttr != 0xffffffff) {
  35. SetFileAttributesW(csFileName, dwAttr & ~FILE_ATTRIBUTE_READONLY);
  36. }
  37. }
  38. CSTRING_CATCH
  39. {
  40. // Don't care about exception
  41. }
  42. }
  43. return TRUE;
  44. }
  45. HOOK_BEGIN
  46. CALL_NOTIFY_FUNCTION
  47. HOOK_END
  48. IMPLEMENT_SHIM_END