1 /*********************************************************************
2 * RPC for the Windows NT Operating System
3 * 1993 by Martin F. Gergeleit
5 * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO
6 * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE
7 * USE OF. USE ENTIRELY AT YOUR OWN RISK!!!
8 *********************************************************************/
18 CRITICAL_SECTION __thr_mutex;
25 if (WSAStartup(0x0101, &WSAData)) {
27 nt_rpc_report("WSAStartup failed\n");
37 if (init == 0 || --init > 0)
50 case DLL_PROCESS_ATTACH:
51 __thr_key = TlsAlloc();
52 InitializeCriticalSection(&__thr_mutex);
55 case DLL_PROCESS_DETACH:
57 DeleteCriticalSection(&__thr_mutex);
60 case DLL_THREAD_DETACH: {
61 LPVOID ptr=TlsGetValue(__thr_key);
71 nt_rpc_report(LPTSTR lpszMsg)
75 LPTSTR lpszStrings[2];
77 // Use event logging to log the error.
79 hEventSource = RegisterEventSource(NULL,
82 sprintf(chMsg, "sunrpc report: %d", GetLastError());
83 lpszStrings[0] = chMsg;
84 lpszStrings[1] = lpszMsg;
86 if (hEventSource != NULL) {
87 ReportEvent(hEventSource, // handle of event source
88 EVENTLOG_WARNING_TYPE, // event type
91 NULL, // current user's SID
92 2, // strings in lpszStrings
93 0, // no bytes of raw data
94 lpszStrings, // array of error strings
97 (VOID) DeregisterEventSource(hEventSource);