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.

294 lines
11 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: srvr.h
  3. *
  4. * PURPOSE: Private definitions file for server code
  5. *
  6. * Created: 1990
  7. *
  8. * Copyright (c) 1990, 1991 Microsoft Corporation
  9. *
  10. * History:
  11. * Raor (../../90,91) Original
  12. *
  13. \***************************************************************************/
  14. #define DEFSTD_ITEM_INDEX 0
  15. #define STDTARGETDEVICE 1
  16. #define STDDOCDIMENSIONS 2
  17. #define STDCOLORSCHEME 3
  18. #define STDHOSTNAMES 4
  19. #define PROTOCOL_EDIT ((LPSTR)"StdFileEditing")
  20. #define PROTOCOL_EXECUTE ((LPSTR)"StdExecute")
  21. #define SRVR_CLASS ((LPSTR)"SrvrWndClass")
  22. #define DOC_CLASS ((LPSTR)"DocWndClass")
  23. #define ITEM_CLASS ((LPSTR)"ItemWndClass")
  24. #define ISATOM(a) ((a >= 0xC000) && (a <= 0xFFFF))
  25. #define MAX_STR 124
  26. #define WW_LPTR 0 // ptr tosrvr/doc/item
  27. #define WW_LE 4 // signature
  28. #define WW_HANDLE 6 // instance handle
  29. #define WC_LE 0x4c45 // LE chars
  30. // If we running under WLO, the HIGHWORD of version number will be >= 0x0A00
  31. #define VER_WLO 0x0A00
  32. extern WORD CheckPointer (LPVOID, int);
  33. #define READ_ACCESS 0
  34. #define WRITE_ACCESS 1
  35. #define PROBE_READ(lp){\
  36. if (!CheckPointer(lp, READ_ACCESS))\
  37. return OLE_ERROR_ADDRESS; \
  38. }
  39. #define PROBE_WRITE(lp){\
  40. if (!CheckPointer(lp, WRITE_ACCESS))\
  41. return OLE_ERROR_ADDRESS; \
  42. }
  43. #define OLE_COMMAND 1
  44. #define NON_OLE_COMMAND 2
  45. #define WT_SRVR 0 // server window
  46. #define WT_DOC 1 // document window
  47. #define PROBE_BLOCK(lpsrvr) { \
  48. if (lpsrvr->bBlock) \
  49. return OLE_ERROR_SERVER_BLOCKED; \
  50. }
  51. #define SET_MSG_STATUS(retval, status) { \
  52. if (retval == OLE_OK) \
  53. status |= 0x8000; \
  54. if (retval == OLE_BUSY) \
  55. status |= 0x4000; \
  56. }
  57. typedef LHSERVER LHSRVR;
  58. typedef LHSERVERDOC LHDOC;
  59. typedef struct _QUE { // nodes in Block/Unblock queue
  60. HWND hwnd; //***
  61. unsigned msg; // window
  62. WORD wParam; // procedure parameters
  63. LONG lParam; //***
  64. HANDLE hqNext; // handle to next node
  65. } QUE;
  66. typedef QUE NEAR * PQUE;
  67. typedef QUE FAR * LPQUE;
  68. typedef struct _SRVR { /*srvr*/ // private data
  69. LPOLESERVER lpolesrvr; // corresponding server
  70. char sig[2]; // signature "SR"
  71. HANDLE hsrvr; // global handle
  72. ATOM aClass; // class atom
  73. ATOM aExe;
  74. HWND hwnd; // corresponding window
  75. BOOL bTerminate; // Set if we are terminating.
  76. int termNo; // termination count
  77. BOOL relLock; // ok to release the server.
  78. BOOL bnoRelease; // Block release. call
  79. WORD useFlags; // instance usage flags
  80. int cClients; // no of clients;
  81. BOOL bBlock; // blocked if TRUE
  82. BOOL bBlockedMsg; // msg from block queue if TRUE
  83. HANDLE hqHead; // Head and tail of the blocked
  84. HANDLE hqTail; // messages queue.
  85. HANDLE hqPostHead; // Head and tail of the blocked post msg
  86. HANDLE hqPostTail; // .
  87. BOOL fAckExit;
  88. HWND hwndExit;
  89. HANDLE hDataExit;
  90. } SRVR;
  91. typedef SRVR FAR *LPSRVR;
  92. LONG FAR PASCAL DocWndProc (HWND, WORD, WORD, LONG);
  93. LONG FAR PASCAL ItemWndProc (HWND, WORD, WORD, LONG);
  94. LONG FAR PASCAL SrvrWndProc (HWND, WORD, WORD, LONG);
  95. BOOL FAR PASCAL TerminateClients (HWND, LPSTR, HANDLE);
  96. void SendMsgToChildren (HWND, WORD, WORD, LONG);
  97. OLESTATUS INTERNAL RequestDataStd (LONG, HANDLE FAR *);
  98. BOOL INTERNAL ValidateSrvrClass (LPSTR, ATOM FAR *);
  99. ATOM INTERNAL GetExeAtom (LPSTR);
  100. BOOL INTERNAL AddClient (HWND, HANDLE, HANDLE);
  101. BOOL INTERNAL DeleteClient (HWND, HANDLE);
  102. HANDLE INTERNAL FindClient (HWND, HANDLE);
  103. BOOL INTERNAL MakeSrvrStr(LPSTR, int, LPSTR, HANDLE);
  104. int INTERNAL RevokeAllDocs (LPSRVR);
  105. int INTERNAL ReleaseSrvr (LPSRVR);
  106. void INTERNAL WaitForTerminate (LPSRVR);
  107. OLESTATUS INTERNAL SrvrExecute (HWND, HANDLE, HWND);
  108. BOOL INTERNAL HandleInitMsg (LPSRVR, LONG);
  109. BOOL INTERNAL QueryRelease (LPSRVR);
  110. BOOL INTERNAL IsSingleServerInstance (void);
  111. void INTERNAL MapToHexStr (LPSTR, HANDLE);
  112. void INTERNAL UtilMemCpy (LPSTR, LPSTR, DWORD);
  113. HANDLE INTERNAL DuplicateData (HANDLE);
  114. LPSTR INTERNAL ScanBoolArg (LPSTR, BOOL FAR *);
  115. LPSTR INTERNAL ScanNumArg (LPSTR, LPINT);
  116. LPSTR INTERNAL ScanArg(LPSTR);
  117. ATOM INTERNAL MakeDataAtom (ATOM, int);
  118. ATOM INTERNAL DuplicateAtom (ATOM);
  119. // doc stuff
  120. typedef struct _DOC { /*doc*/ // private data
  121. LPOLESERVERDOC lpoledoc; // corresponding oledoc
  122. char sig[2]; // signature "SD"
  123. HANDLE hdoc; // global handle
  124. ATOM aDoc;
  125. HWND hwnd;
  126. BOOL bTerminate;
  127. int termNo;
  128. int cClients; // no of clients;
  129. BOOL fEmbed; // TRUE if embedded document
  130. BOOL fAckClose;
  131. HWND hwndClose;
  132. HANDLE hDataClose;
  133. } DOC;
  134. typedef DOC FAR *LPDOC;
  135. LPDOC INTERNAL FindDoc (LPSRVR, LPSTR);
  136. int INTERNAL ReleaseDoc (LPDOC);
  137. OLESTATUS INTERNAL DocExecute (HWND, HANDLE, HWND);
  138. BOOL FAR PASCAL TerminateDocClients (HWND, LPSTR, HANDLE);
  139. int INTERNAL DocShowItem (LPDOC, LPSTR, BOOL);
  140. int INTERNAL DocDoVerbItem (LPDOC, LPSTR, WORD, BOOL, BOOL);
  141. // client struct definitions.
  142. typedef struct _CLIENT { /*doc*/ // private data
  143. OLECLIENT oleClient; // oleclient structure
  144. LPOLEOBJECT lpoleobject; // corresponding oledoc
  145. HANDLE hclient; // global handle
  146. ATOM aItem; // item atom or index for some std items
  147. HWND hwnd; // item window
  148. HANDLE hdevInfo; // latest printer dev info sent
  149. } CLIENT;
  150. typedef CLIENT FAR *LPCLIENT;
  151. typedef struct _CLINFO { /*clInfo*/ // client transaction info
  152. HWND hwnd; // client window handle
  153. BOOL bnative; // doe sthis client require native
  154. int format; // dusplay format
  155. int options; // transaction advise time otipns
  156. BOOL bdata; // need wdat with advise?
  157. HANDLE hdevInfo; // device info handle
  158. BOOL bnewDevInfo; // new device info
  159. } CLINFO;
  160. typedef CLINFO *PCLINFO;
  161. BOOL FAR PASCAL FindItemWnd (HWND, LONG);
  162. BOOL FAR PASCAL SendRenameMsg (HWND, LPSTR, HANDLE);
  163. BOOL FAR PASCAL EnumForTerminate (HWND, LPSTR, HANDLE);
  164. BOOL FAR PASCAL SendDataMsg(HWND, LPSTR, HANDLE);
  165. BOOL FAR PASCAL DeleteClientInfo (HWND, LPSTR, HANDLE);
  166. int FAR PASCAL ItemCallBack (LPOLECLIENT, int, LPOLEOBJECT);
  167. int INTERNAL RegisterItem (LHDOC, LPSTR, LPCLIENT FAR *, BOOL);
  168. int INTERNAL FindItem (LPDOC, LPSTR, LPCLIENT FAR *);
  169. HWND INTERNAL SearchItem (LPDOC, LPSTR);
  170. void INTERNAL DeleteFromItemsList (HWND, HWND);
  171. void INTERNAL DeleteAllItems (HWND);
  172. OLESTATUS INTERNAL PokeData (LPDOC, HWND, LONG);
  173. HANDLE INTERNAL MakeItemData (DDEPOKE FAR *, HANDLE, OLECLIPFORMAT);
  174. OLESTATUS INTERNAL AdviseData (LPDOC, HWND, LONG, BOOL FAR *);
  175. OLESTATUS INTERNAL AdviseStdItems (LPDOC, HWND, LONG, BOOL FAR *);
  176. OLESTATUS INTERNAL UnAdviseData (LPDOC, HWND, LONG);
  177. OLESTATUS INTERNAL RequestData (LPDOC, HWND, LONG, HANDLE FAR *);
  178. BOOL INTERNAL MakeDDEData (HANDLE, int, LPHANDLE, BOOL);
  179. HANDLE INTERNAL MakeGlobal (LPSTR);
  180. int INTERNAL ScanItemOptions (LPSTR, int far *);
  181. OLESTATUS INTERNAL PokeStdItems (LPDOC, HWND, LONG);
  182. int INTERNAL GetStdItemIndex (ATOM);
  183. BOOL INTERNAL IsAdviseStdItems (ATOM);
  184. int INTERNAL SetStdInfo (LPDOC, HWND, LPSTR, HANDLE);
  185. void INTERNAL SendDevInfo (LPCLIENT, LPSTR);
  186. BOOL INTERNAL IsFormatAvailable (LPCLIENT, OLECLIPFORMAT);
  187. OLESTATUS INTERNAL RevokeObject (LPOLECLIENT, BOOL);
  188. BOOL INTERNAL AddMessage (HWND, unsigned, WORD, LONG, int);
  189. #define ITEM_FIND 1 // find the item
  190. #define ITEM_DELETECLIENT 2 // delete the client from item clients
  191. #define ITEM_DELETE 3 // delete th item window itself
  192. #define ITEM_SAVED 4 // item saved
  193. // host names data structcure
  194. typedef struct _HOSTNAMES {
  195. WORD clientNameOffset;
  196. WORD documentNameOffset;
  197. BYTE data[];
  198. } HOSTNAMES;
  199. typedef HOSTNAMES FAR * LPHOSTNAMES;
  200. // routines in UTILS.C
  201. void INTERNAL MapToHexStr (LPSTR, HANDLE);
  202. void INTERNAL UtilMemCpy (LPSTR, LPSTR, DWORD);
  203. HANDLE INTERNAL DuplicateData (HANDLE);
  204. LPSTR INTERNAL ScanLastBoolArg (LPSTR);
  205. LPSTR INTERNAL ScanArg(LPSTR);
  206. WORD INTERNAL ScanCommand(LPSTR, WORD, LPSTR FAR *, ATOM FAR *);
  207. ATOM INTERNAL MakeDataAtom (ATOM, int);
  208. ATOM INTERNAL DuplicateAtom (ATOM);
  209. WORD INTERNAL StrToInt (LPSTR);
  210. BOOL INTERNAL CheckServer (LPSRVR);
  211. BOOL INTERNAL CheckServerDoc (LPDOC);
  212. BOOL INTERNAL PostMessageToClientWithBlock (HWND, WORD, WORD, DWORD);
  213. BOOL INTERNAL PostMessageToClient (HWND, WORD, WORD, DWORD);
  214. BOOL INTERNAL IsWindowValid (HWND);
  215. BOOL INTERNAL IsOleCommand (ATOM, WORD);
  216. BOOL INTERNAL UtilQueryProtocol (ATOM, LPSTR);
  217. // routines for queueing messages and posting them
  218. BOOL INTERNAL UnblockPostMsgs(HWND, BOOL);
  219. BOOL INTERNAL BlockPostMsg (HWND, WORD, WORD, LONG);
  220. BOOL INTERNAL IsBlockQueueEmpty (HWND);
  221. // routine in GIVE2GDI.ASM
  222. HANDLE FAR PASCAL GiveToGDI (HANDLE);
  223. // routine in item.c
  224. HBITMAP INTERNAL DuplicateBitmap (HBITMAP);
  225. HANDLE INTERNAL DuplicateMetaFile (HANDLE);
  226. // routines in doc.c
  227. void INTERNAL FreePokeData (HANDLE);
  228. BOOL INTERNAL FreeGDIdata (HANDLE, OLECLIPFORMAT);