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.

69 lines
1.6 KiB

  1. // ----------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1997, Microsoft Corporation.
  4. //
  5. // Routine: DllMain
  6. //
  7. // Description:
  8. //
  9. // Returns: True if successful, else False.
  10. // History: Weibz, 10-Nov-1997, created it.
  11. //
  12. //---------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. CRITICAL_SECTION ThCritSect;
  15. SCRIPTITEMIZE ScriptItemize;
  16. SCRIPTBREAK ScriptBreak;
  17. HMODULE hUsp;
  18. BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
  19. {
  20. CHAR szUSPPath[MAX_PATH];
  21. switch(dwReason)
  22. {
  23. case DLL_PROCESS_ATTACH :
  24. DisableThreadLibraryCalls(hDLL);
  25. InitializeCriticalSection (&ThCritSect);
  26. GetSystemDirectory ( szUSPPath, MAX_PATH );
  27. strcat ( szUSPPath, "\\USP.DLL" );
  28. hUsp = LoadLibrary (szUSPPath);
  29. if ( hUsp == NULL )
  30. return FALSE;
  31. ScriptItemize = (SCRIPTITEMIZE)GetProcAddress(hUsp,"ScriptItemize");
  32. ScriptBreak = (SCRIPTBREAK) GetProcAddress(hUsp,"ScriptBreak");
  33. if ( (ScriptItemize==NULL) || (ScriptBreak==NULL) )
  34. return FALSE;
  35. break ;
  36. case DLL_THREAD_ATTACH:
  37. break;
  38. case DLL_THREAD_DETACH:
  39. break;
  40. case DLL_PROCESS_DETACH :
  41. if (hUsp != NULL )
  42. FreeLibrary(hUsp);
  43. hUsp = NULL;
  44. DeleteCriticalSection (&ThCritSect);
  45. break ;
  46. } //switch
  47. return TRUE ;
  48. }