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.

59 lines
1.2 KiB

  1. // getrcmsg.c
  2. #include "windows.h"
  3. static HINSTANCE hInstModule = NULL;
  4. HINSTANCE
  5. SetHInstance(HINSTANCE h)
  6. {
  7. HINSTANCE hRet = hInstModule;
  8. hInstModule = h;
  9. return hRet;
  10. }
  11. char *
  12. get_err(int msg_num)
  13. {
  14. static char rgchErr[1024];
  15. #if !defined(HARD_LINK)
  16. static HMODULE hmodUser32;
  17. static int (WINAPI *pfnLoadStringA)(HINSTANCE, UINT, LPSTR, int);
  18. if (hmodUser32 == NULL) {
  19. hmodUser32 = LoadLibrary("USER32.DLL");
  20. if (hmodUser32 == NULL) {
  21. return NULL;
  22. }
  23. }
  24. if (pfnLoadStringA == NULL) {
  25. pfnLoadStringA = (int (WINAPI *)(HINSTANCE, UINT, LPSTR, int))
  26. GetProcAddress(hmodUser32, "LoadStringA");
  27. if (pfnLoadStringA == NULL) {
  28. return NULL;
  29. }
  30. }
  31. if ((*pfnLoadStringA)(hInstModule, msg_num, rgchErr, sizeof(rgchErr)) == 0) {
  32. rgchErr[0] = '\0';
  33. }
  34. #else
  35. #pragma comment(lib, "user32")
  36. if (LoadString(hInstModule, msg_num, rgchErr, sizeof(rgchErr)) == 0) {
  37. rgchErr[0] = '\0';
  38. }
  39. #endif
  40. return rgchErr;
  41. }
  42. int
  43. SetErrorFile(char *pFilename, char *pExeName, int fSearchExePath)
  44. {
  45. return 1;
  46. }