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.

63 lines
870 B

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. util.c
  5. Abstract:
  6. This module contains the common utilities used in PSXSES module
  7. Author:
  8. Avi Nathan (avin) 17-Jul-1991
  9. Environment:
  10. User Mode Only
  11. Revision History:
  12. --*/
  13. #define WIN32_ONLY
  14. #include "psxses.h"
  15. #include "util.h"
  16. #include <stdio.h>
  17. #include <direct.h>
  18. #include <windows.h>
  19. DWORD
  20. GetSessionUniqueId(VOID)
  21. {
  22. return(GetCurrentProcessId());
  23. }
  24. LPTSTR
  25. MyLoadString(UINT Id)
  26. {
  27. TCHAR buf[100];
  28. PTCHAR ptc;
  29. HINSTANCE hInstance;
  30. int r;
  31. hInstance = GetModuleHandle(NULL);
  32. r = LoadString(hInstance, Id, buf, (int)sizeof(buf));
  33. if (0 == r) {
  34. // String rsrc doesn't exist.
  35. KdPrint(("PSXSES: LoadString: 0x%x\n", GetLastError()));
  36. return NULL;
  37. }
  38. ptc = LocalAlloc(0, (r + 1)*sizeof(TCHAR));
  39. if (NULL == ptc) {
  40. return NULL;
  41. }
  42. return lstrcpy(ptc, buf);
  43. }