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.

56 lines
879 B

  1. /*
  2. * FIXMAPI.C
  3. *
  4. * MAPI Repair Tool executable for NT5
  5. */
  6. #include <windows.h>
  7. #ifndef MB_SETFOREGROUND
  8. #define MB_SETFOREGROUND 0
  9. #endif
  10. void InstallAlert(LPTSTR szErr);
  11. int WINAPI
  12. ModuleEntry()
  13. {
  14. HINSTANCE hinst;
  15. hinst = LoadLibrary("mapistub.dll");
  16. if (!hinst)
  17. {
  18. DWORD dw = GetLastError();
  19. TCHAR sz[MAX_PATH];
  20. wsprintf(sz, "LoadLibrary: GetLastError = %d", dw);
  21. InstallAlert(sz);
  22. }
  23. else
  24. {
  25. FARPROC pfn;
  26. pfn = GetProcAddress(hinst, "FixMAPI");
  27. if (!pfn)
  28. {
  29. DWORD dw = GetLastError();
  30. TCHAR sz[MAX_PATH];
  31. wsprintf(sz, "GetProcAddress: GetLastError = %d", dw);
  32. InstallAlert(sz);
  33. }
  34. else
  35. {
  36. (*pfn)(); // Call FixMAPI()
  37. }
  38. }
  39. ExitProcess(0);
  40. }
  41. void
  42. InstallAlert(LPTSTR szErr)
  43. {
  44. MessageBox(NULL, szErr, "MAPI Repair Tool", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND);
  45. }