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.

97 lines
1.7 KiB

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <stdarg.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <crt\stddef.h>
  7. #include "evttbl.h"
  8. BOOL
  9. WINAPI
  10. DLLMAIN(
  11. HINSTANCE hInstance,
  12. DWORD dwReason,
  13. PVOID pUnused
  14. )
  15. {
  16. switch(dwReason) {
  17. case DLL_PROCESS_ATTACH:
  18. DisableThreadLibraryCalls(hInstance);
  19. break;
  20. case DLL_PROCESS_DETACH:
  21. break;
  22. default:
  23. break;
  24. }
  25. return TRUE;
  26. }
  27. DWORD
  28. GetEventIds(
  29. IN PWCHAR pwszComponent,
  30. IN PWCHAR pwszSubComponent,
  31. OUT PDWORD pdwEventIds,
  32. OUT PULONG pulEventCount
  33. )
  34. {
  35. ULONG i;
  36. PSUBCOMP_ENTRY pInfo;
  37. pInfo = NULL;
  38. for(i = 0; i < g_ulCompCount; i++)
  39. {
  40. ULONG j;
  41. if(_wcsicmp(pwszComponent,
  42. g_Components[i]->pwszComponent) != 0)
  43. {
  44. continue;
  45. }
  46. for(j = 0; j < g_Components[i]->ulSubcompCount; j++)
  47. {
  48. if(_wcsicmp(pwszSubComponent,
  49. g_Components[i]->SubcompInfo[j].pwszSubComp) == 0)
  50. {
  51. pInfo = &(g_Components[i]->SubcompInfo[j]);
  52. break;
  53. }
  54. }
  55. if(pInfo)
  56. {
  57. break;
  58. }
  59. }
  60. if(pInfo == NULL)
  61. {
  62. return ERROR_NOT_FOUND;
  63. }
  64. if(pInfo->ulEventCount > *pulEventCount)
  65. {
  66. *pulEventCount = pInfo->ulEventCount;
  67. return ERROR_INSUFFICIENT_BUFFER;
  68. }
  69. *pulEventCount = pInfo->ulEventCount;
  70. CopyMemory(pdwEventIds,
  71. pInfo->Events,
  72. (sizeof(DWORD) * pInfo->ulEventCount));
  73. return NO_ERROR;
  74. }