dxv.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. // ************************************************************************
  5. // FUNCTION : DllMain( HINSTANCE, DWORD, LPVOID )
  6. // PURPOSE : DllMain is called by the C run-time library from the
  7. // _DllMainCRTStartup entry point. The DLL entry point gets
  8. // called (entered) on the following events: "Process Attach",
  9. // "Thread Attach", "Thread Detach" or "Process Detach".
  10. // COMMENTS : No initialization is needed here so this entry point simply
  11. // returns TRUE.
  12. // ************************************************************************
  13. BOOL WINAPI
  14. DllMain( HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved )
  15. {
  16. UNREFERENCED_PARAMETER( hInstDLL );
  17. UNREFERENCED_PARAMETER( fdwReason );
  18. UNREFERENCED_PARAMETER( lpvReserved );
  19. return( TRUE );
  20. }
  21. int DXV_GetVersion()
  22. {
  23. return (int)0x0365;
  24. }
  25. extern "C" {
  26. char* pannounce;
  27. char *announcestart;
  28. #define ANNBUFSIZE 2048
  29. FILE* hf = NULL;
  30. void Announcement(const char* lpszString)
  31. {
  32. #if _DEBUG
  33. if (!hf) {
  34. hf = fopen("Announce.txt","w");
  35. }
  36. if (hf) {
  37. fprintf(hf,lpszString);
  38. fflush(hf);
  39. }
  40. #endif
  41. if ((2 * strlen(lpszString) + pannounce) > announcestart + ANNBUFSIZE) {
  42. pannounce = announcestart + ANNBUFSIZE - 2 * strlen(lpszString); // lock up at end
  43. }
  44. strcpy(pannounce,lpszString); // copy and bump
  45. pannounce += strlen(lpszString);
  46. }
  47. void AnnDone()
  48. {
  49. #if _DEBUG
  50. Announcement("Closing Announcements");
  51. if(hf) fclose(hf);
  52. // hf = 0; // don't reset handle or file will re-open on next call
  53. #endif
  54. }
  55. void ErrorBuffer(char *errorbuf)
  56. {
  57. pannounce = announcestart = errorbuf;
  58. }
  59. }