Leaked source code of windows server 2003
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.

359 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. proto.h
  5. Abstract:
  6. This file contain function prototypes for the BINL service.
  7. Author:
  8. Colin Watson (colinw) 11-Aug-1997
  9. Environment:
  10. User Mode - Win32 - MIDL
  11. Revision History:
  12. --*/
  13. //
  14. // network.c
  15. //
  16. DWORD
  17. BinlWaitForMessage(
  18. BINL_REQUEST_CONTEXT *pRequestContext
  19. );
  20. DWORD
  21. BinlSendMessage(
  22. LPBINL_REQUEST_CONTEXT BinlRequestContext
  23. );
  24. DHCP_IP_ADDRESS
  25. BinlGetMyNetworkAddress (
  26. LPBINL_REQUEST_CONTEXT RequestContext
  27. );
  28. NTSTATUS
  29. GetIpAddressInfo (
  30. ULONG Delay
  31. );
  32. VOID
  33. FreeIpAddressInfo (
  34. VOID
  35. );
  36. //
  37. // main.c
  38. //
  39. DWORD
  40. ReadDWord(
  41. HKEY KeyHandle,
  42. LPTSTR lpValueName,
  43. DWORD DefaultValue
  44. );
  45. DWORD
  46. BinlRegGetValue(
  47. HKEY KeyHandle,
  48. LPWSTR ValueName,
  49. DWORD ValueType,
  50. LPBYTE * BufferPtr
  51. );
  52. DWORD
  53. GetBinlServerParameters(
  54. BOOL GlobalSearch);
  55. DWORD
  56. BinlInitializeEndpoint(
  57. PENDPOINT pEndpoint,
  58. PDHCP_IP_ADDRESS pIpAddress,
  59. DWORD Port
  60. );
  61. VOID
  62. SendWakeup(
  63. PENDPOINT pEndpoint
  64. );
  65. DWORD
  66. MaybeInitializeEndpoint(
  67. PENDPOINT pEndpoint,
  68. PDHCP_IP_ADDRESS pIpAddress,
  69. DWORD Port
  70. );
  71. VOID
  72. MaybeCloseEndpoint(
  73. PENDPOINT pEndpoint
  74. );
  75. VOID
  76. BinlMessageLoop(
  77. LPVOID Parameter
  78. );
  79. DWORD
  80. BinlStartWorkerThread(
  81. BINL_REQUEST_CONTEXT **ppContext
  82. );
  83. VOID
  84. BinlProcessingLoop(
  85. VOID
  86. );
  87. BOOL
  88. BinlIsProcessMessageExecuting(
  89. VOID
  90. );
  91. BOOL
  92. BinlIsProcessMessageBusy(
  93. VOID
  94. );
  95. DWORD
  96. Scavenger(
  97. VOID
  98. );
  99. VOID
  100. ServiceEntry(
  101. DWORD NumArgs,
  102. LPWSTR *ArgsArray,
  103. IN PTCPSVCS_GLOBAL_DATA pGlobalData
  104. );
  105. NTSTATUS
  106. BinlSetupPnpWait (
  107. VOID
  108. );
  109. // message.c
  110. DWORD
  111. ProcessMessage(
  112. LPBINL_REQUEST_CONTEXT RequestContext
  113. );
  114. DWORD
  115. ProcessBinlDiscover(
  116. LPBINL_REQUEST_CONTEXT RequestContext,
  117. LPDHCP_SERVER_OPTIONS dhcpOptions
  118. );
  119. DWORD
  120. ProcessBinlRequest(
  121. LPBINL_REQUEST_CONTEXT RequestContext,
  122. LPDHCP_SERVER_OPTIONS dhcpOptions
  123. );
  124. DWORD
  125. ProcessBinlInform(
  126. LPBINL_REQUEST_CONTEXT RequestContext,
  127. LPDHCP_SERVER_OPTIONS DhcpOptions
  128. );
  129. DWORD
  130. UpdateAccount(
  131. PCLIENT_STATE ClientState,
  132. PMACHINE_INFO pMachineInfo,
  133. BOOL fCreateAccount
  134. );
  135. DWORD
  136. GetBootParameters(
  137. PUCHAR pGuid,
  138. PMACHINE_INFO * pMachineInfo,
  139. DWORD dwRequestedInfo,
  140. USHORT SystemArchitecture,
  141. BOOL AllowOSChooser
  142. );
  143. DWORD
  144. VerifyExistingClient(
  145. PUCHAR Guid
  146. );
  147. DWORD
  148. InitializeConnection(
  149. BOOL Global,
  150. PLDAP * LdapHandle,
  151. PWCHAR ** Base);
  152. VOID
  153. HandleLdapFailure(
  154. DWORD LdapError,
  155. DWORD EventId,
  156. BOOL GlobalCatalog,
  157. PLDAP *LdapHandle,
  158. BOOL HaveLock
  159. );
  160. VOID
  161. FreeConnections(
  162. VOID
  163. );
  164. DWORD
  165. BinlReportEventW(
  166. DWORD EventID,
  167. DWORD EventType,
  168. DWORD NumStrings,
  169. DWORD DataLength,
  170. LPWSTR *Strings,
  171. LPVOID Data
  172. );
  173. DWORD
  174. BinlReportEventA(
  175. DWORD EventID,
  176. DWORD EventType,
  177. DWORD NumStrings,
  178. DWORD DataLength,
  179. LPSTR *Strings,
  180. LPVOID Data
  181. );
  182. VOID
  183. BinlLogDuplicateDsRecords (
  184. LPGUID Guid,
  185. LDAP *LdapHandle,
  186. LDAPMessage *LdapMessage,
  187. LDAPMessage *CurrentEntry
  188. );
  189. //
  190. // osc.c
  191. //
  192. DWORD
  193. OscUpdatePassword(
  194. IN PCLIENT_STATE ClientState,
  195. IN PWCHAR SamAccountName,
  196. IN PWCHAR Password,
  197. IN LDAP * LdapHandle,
  198. IN PLDAPMessage LdapMessage
  199. );
  200. //
  201. // Routines for caching the DS responses and to ensure that we don't work on
  202. // a request that we're already working on.
  203. //
  204. DWORD
  205. BinlCreateOrFindCacheEntry (
  206. PCHAR Guid,
  207. BOOLEAN CreateIfNotExist,
  208. PMACHINE_INFO *CacheEntry
  209. );
  210. VOID
  211. BinlDoneWithCacheEntry (
  212. PMACHINE_INFO pMachineInfo,
  213. BOOLEAN FreeIt
  214. );
  215. VOID
  216. BinlCloseCache (
  217. VOID
  218. );
  219. void
  220. OscCreateLDAPSubError(
  221. PCLIENT_STATE clientState,
  222. DWORD Error );
  223. #ifndef DSCRACKNAMES_DNS
  224. DWORD
  225. BinlDNStoFQDN(
  226. PWCHAR pMachineName,
  227. PWCHAR * ppMachineDN );
  228. #endif
  229. DWORD
  230. GetOurServerInfo (
  231. VOID
  232. );
  233. //
  234. // rogue.c
  235. //
  236. NTSTATUS
  237. MaybeStartRogueThread (
  238. VOID
  239. );
  240. VOID
  241. StopRogueThread (
  242. VOID
  243. );
  244. VOID
  245. HandleRogueAuthorized (
  246. VOID
  247. );
  248. VOID
  249. HandleRogueUnauthorized (
  250. VOID
  251. );
  252. VOID
  253. LogCurrentRogueState (
  254. BOOL ResponseToMessage
  255. );
  256. VOID
  257. LogLdapError (
  258. ULONG LdapEvent,
  259. ULONG LdapError,
  260. PLDAP LdapHandle OPTIONAL
  261. );
  262. BOOL
  263. BinlAnsiToUnicode(
  264. IN PSTR AnsiString,
  265. OUT PWSTR UnicodeBuffer,
  266. IN USHORT UnicodeBufferSize
  267. );
  268. BOOL
  269. BinlUnicodeToAnsi(
  270. IN PWSTR UnicodeString,
  271. OUT PSTR AnsiBuffer,
  272. IN USHORT AnsiBufferSize
  273. );
  274. //
  275. // Create a copy of a string by allocating heap memory.
  276. //
  277. LPSTR
  278. BinlStrDupA( LPCSTR pStr );
  279. LPWSTR
  280. BinlStrDupW( LPCWSTR pStr );
  281. // We should always be UNICODE
  282. #define BinlStrDup BinlStrDupW
  283. #if DBG==1
  284. #define BinlAllocateMemory(x) DebugAlloc( __FILE__, __LINE__, "BINL", LMEM_FIXED | LMEM_ZEROINIT, x, #x)
  285. #define BinlFreeMemory(x) DebugFree(x)
  286. #else // DBG==0
  287. #define BinlAllocateMemory(x) LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT, x)
  288. #define BinlFreeMemory(x) LocalFree(x)
  289. #endif // DBG==1