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.

89 lines
1.9 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <tchar.h>
  6. #include <comdef.h>
  7. #include <msxml2.h>
  8. #include <winsvc.h>
  9. #include <atlbase.h>
  10. CComModule _Module;
  11. #include <atlcom.h>
  12. #include "..\obj\i386\kbproc.h"
  13. #include "..\obj\i386\kbproc_i.c"
  14. #include "..\process.h"
  15. int __cdecl wmain(int argc, wchar_t *argv[])
  16. {
  17. HRESULT hr;
  18. DWORD rc;
  19. WCHAR szKB[MAX_PATH+30];
  20. WCHAR szMain[MAX_PATH+30];
  21. if ( !GetSystemWindowsDirectory(szKB, MAX_PATH + 1) ) {
  22. wprintf(L"Error GetSystemWindowsDirectory() %d \n", GetLastError());
  23. return 0;
  24. }
  25. wcscat(szKB, L"\\security\\ssr\\kbs\\DotNetKB.xml");
  26. if ( !GetSystemWindowsDirectory(szMain, MAX_PATH + 1) ) {
  27. wprintf(L"Error GetSystemWindowsDirectory() %d \n", GetLastError());
  28. return 0;
  29. }
  30. wcscat(szMain, L"\\security\\ssr\\kbs\\Main.xml");
  31. hr = CoInitialize(NULL);
  32. if (FAILED(hr)) {
  33. wprintf(L"\nCOM failed to initialize\n");
  34. return 0;
  35. }
  36. Iprocess *pPreProc;
  37. //
  38. // instantiate the DOM document object to process the KB
  39. //
  40. hr = CoCreateInstance(CLSID_process,
  41. NULL,
  42. CLSCTX_INPROC_SERVER,
  43. IID_Iprocess,
  44. (void**)&pPreProc);
  45. VARIANT vtFeedback;
  46. VariantInit(&vtFeedback);
  47. vtFeedback.vt = VT_NULL;
  48. vtFeedback.punkVal = NULL;
  49. if (FAILED(hr) || pPreProc == NULL ) {
  50. wprintf(L"\nCOM failed to create a PreProc instance\n");
  51. goto ExitHandler;
  52. }
  53. hr = pPreProc->preprocess(szKB, szMain, L"Typical", L"ssr.log", NULL, vtFeedback);
  54. hr = pPreProc->Release();
  55. if (FAILED(hr) ) {
  56. wprintf(L"\nUnable to get the PreProc interface\n");
  57. goto ExitHandler;
  58. }
  59. ExitHandler:
  60. CoUninitialize();
  61. }