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.

65 lines
1.8 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: MAIN.CPP
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 9/6/1999
  12. *
  13. * DESCRIPTION: Test program for the debugging classes
  14. *
  15. *******************************************************************************/
  16. #include <windows.h>
  17. #define INITGUID
  18. #include "wianew.h"
  19. #include "wiadebug.h"
  20. #include "simcrit.h"
  21. void Function( int n )
  22. {
  23. WIA_PUSH_FUNCTION((TEXT("Function( %d )"), n ));
  24. }
  25. DWORD WINAPI ThreadProc( LPVOID pVoid )
  26. {
  27. WIA_PUSH_FUNCTION_MASK(( 0x00000001, TEXT("ThreadProc( %d )"), (int)(INT_PTR)pVoid ));
  28. //WIA_PRINTGUID((IID_IUnknown,TEXT("I am printing IID_MYTEST")));
  29. Function( (int)(INT_PTR)pVoid );
  30. for (int i=0;i<5;i++)
  31. {
  32. WIA_TRACE((TEXT("This is a test (incrementing %d)"), i));
  33. WIA_WARNING((TEXT("This is a warning (%d)"), i));
  34. WIA_ERROR((TEXT("This is an error (%d)"), i));
  35. WIA_PRINTHRESULT((E_NOTIMPL,TEXT("This is an HRESULT error (%d)"), i));
  36. Sleep(0);
  37. }
  38. return 0;
  39. }
  40. int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCommandLine, int nCmdShow )
  41. {
  42. WIA_DEBUG_CREATE( hInstance );
  43. WIA_PUSH_FUNCTION((TEXT("WinMain( %08X, %08X, \"%hs\", %d )"), hInstance, hPrevInstance, pszCommandLine, nCmdShow ));
  44. const int nHandles = MAXIMUM_WAIT_OBJECTS-10;
  45. HANDLE Handles[nHandles];
  46. for (int i=0;i<nHandles;i++)
  47. {
  48. DWORD dwThreadId;
  49. Handles[i] = CreateThread( NULL, 0, ThreadProc, (PVOID)i, 0, &dwThreadId );
  50. }
  51. WaitForMultipleObjects( nHandles, Handles, TRUE, INFINITE );
  52. for (i=0;i<nHandles;i++)
  53. {
  54. CloseHandle( Handles[i] );
  55. }
  56. WIA_REPORT_LEAKS();
  57. WIA_DEBUG_DESTROY();
  58. return 0;
  59. }