Windows NT 4.0 source code leak
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.

172 lines
4.0 KiB

4 years ago
  1. /* --------------------------------------------------------------------
  2. Microsoft OS/2 LAN Manager
  3. Copyright(c) Microsoft Corp., 1990
  4. -------------------------------------------------------------------- */
  5. /* --------------------------------------------------------------------
  6. File: threadsup.c
  7. Description:
  8. This file provides initialization of the ExportTable structure. Glock
  9. can't handle this initialization in threads.cxx, so we do it here
  10. and define the table as extern in threads.cxx.
  11. History:
  12. 2/14/92 [davidst] file created
  13. 5/10/94 [vonj] Added I_RpcRegisteredBufferAllocate and
  14. I_RpcRegisteredBufferFree exports. This change
  15. allows the Microsoft Exchange DOS Client's
  16. Shell-to-DOS function to recognize SPX-registered
  17. buffers and avoid swapping them.
  18. -------------------------------------------------------------------- */
  19. #include "sysinc.h"
  20. #include "rpc.h"
  21. #include "rpcdcep.h"
  22. #include "regalloc.h"
  23. #include "rpctran.h"
  24. #include "rpcndr.h"
  25. #include <dosdll.h>
  26. #include <stdlib.h>
  27. #include <regapi.h>
  28. #define EXPORT_TABLE_VERSION 2
  29. #define SIGNATURE 0xfaa37841
  30. void PAPI * RPC_ENTRY
  31. RpcSetExceptionHandler (
  32. IN pExceptionBuff newhandler
  33. );
  34. void PAPI * RPC_ENTRY
  35. RpcGetExceptionHandler (
  36. );
  37. DWORD RPC_ENTRY ExportTime( void );
  38. extern void far pascal I_NsGetMemoryAllocator(void far * far *, void far * far *);
  39. extern char far * RPC_ENTRY I_DosGetEnv(CONST char __far *);
  40. // The following, table is exported for the transports. The order of
  41. // this table implicitly assigns ordinals to the functions. These
  42. // numbers must match the numbers used in the Export macro in the
  43. // dllinit.asm file.
  44. typedef void (far pascal far * ExportFunction)();
  45. //
  46. // IF YOU MODIFY THIS LIST, PLEASE BE SURE YOU ALSO MODIFY THE LIST IN IMPORTS.INC
  47. //
  48. ExportFunction ExportTable[]= {
  49. (ExportFunction) EXPORT_TABLE_VERSION,
  50. (ExportFunction) SIGNATURE,
  51. I_DosAtExit,
  52. I_DosGetEnv,
  53. (ExportFunction)LoadModR,
  54. (ExportFunction)UnloadModR,
  55. (ExportFunction)GetProcAddrR,
  56. I_RpcTransClientReallocBuffer,
  57. RpcGetExceptionHandler,
  58. RpcSetExceptionHandler,
  59. RpcLeaveException,
  60. RpcBindingCopy,
  61. RpcStringBindingCompose,
  62. RpcStringBindingParse,
  63. RpcBindingToStringBinding,
  64. RpcBindingFromStringBinding,
  65. RpcBindingVectorFree,
  66. RpcBindingFree,
  67. RpcStringFree,
  68. I_RpcAllocate,
  69. I_RpcFree,
  70. I_RpcFreeBuffer,
  71. I_RpcGetBuffer,
  72. I_RpcSendReceive,
  73. I_RpcNsBindingSetEntryName,
  74. RpcRegOpenKey,
  75. RpcRegCreateKey,
  76. RpcRegCloseKey,
  77. RpcRegSetValue,
  78. RpcRegQueryValue,
  79. NDRCContextBinding,
  80. NDRCContextMarshall,
  81. NDRCContextUnmarshall,
  82. RpcSsDestroyClientContext,
  83. I_RpcTransClientMaxFrag,
  84. NdrPointerUnmarshall,
  85. NdrClientContextMarshall,
  86. NdrPointerMarshall,
  87. NdrFreeBuffer,
  88. NdrGetBuffer,
  89. NdrPointerBufferSize,
  90. NdrConvert,
  91. NdrClientInitialize,
  92. NdrClientInitializeNew,
  93. NdrClientContextUnmarshall,
  94. NdrSendReceive,
  95. ExportTime,
  96. I_RpcRegisteredBufferAllocate,
  97. I_RpcRegisteredBufferFree,
  98. I_NsGetMemoryAllocator,
  99. NdrSimpleStructMarshall,
  100. NdrSimpleStructBufferSize
  101. };
  102. //
  103. // IF YOU MODIFY THIS LIST, PLEASE BE SURE YOU ALSO MODIFY THE LIST IN IMPORTS.INC
  104. //
  105. void RPC_ENTRY
  106. I_DosAtExit(
  107. IN AT_EXIT CleanUpRoutine
  108. )
  109. /*++
  110. Routine Description:
  111. Calls the C library runtime to have a function called when the
  112. DOS program terminates.
  113. Arguments:
  114. CleanUpRoutine - function to register
  115. --*/
  116. {
  117. atexit(CleanUpRoutine);
  118. }
  119. void CallExportInit(unsigned long ulDllHandle)
  120. {
  121. void (far * pascal pExport)(void *);
  122. unsigned short usRet;
  123. usRet = GetProcAddrR(ulDllHandle, "ExportInit", (PPFN)&pExport);
  124. if (usRet == 0)
  125. {
  126. (*pExport)(&ExportTable[2]);
  127. }
  128. }
  129. DWORD RPC_ENTRY ExportTime( void )
  130. {
  131. return time(NULL);
  132. }
  133. char far *RPC_ENTRY
  134. I_DosGetEnv(CONST char __far *psz)
  135. {
  136. return(getenv(psz));
  137. }