|
|
1.1 root 1: /* $Header: "%n;%v %f LastEdit=%w Locker=%l" */
2: /* "" */
3: /************************************************************************
4: * Copyright (c) Wonderware Software Development Corp. 1991-1993. *
5: * All Rights Reserved. *
6: *************************************************************************/
7: /* $History: Begin
8:
9: nddeapi.h
10:
11: Network DDE share and trusted share access and control function
12: prototypes, structures and definitions.
13:
14: NOTE: windows.h must be #included first
15:
16: Revisions:
17: 1.00 12/92 PhilH Wonderware port from WFW to NT.
18: 1.01 3/92 IgorM Wonderware addition of separate SD access API
19: and trusted share access API.
20:
21: $History: End */
22:
23:
24: #ifndef _INC_NDDEAPI
25: #define _INC_NDDEAPI
26:
27: #ifndef RC_INVOKED
28: #pragma pack(1) /* Assume byte packing throughout */
29: #endif /* !RC_INVOKED */
30:
31: #ifdef __cplusplus
32: extern "C" { /* Assume C declarations for C++ */
33: #endif /* __cplusplus */
34:
35: #ifndef CNLEN /* If not included with netapi header */
36: #define CNLEN 15 /* Computer name length */
37: #define UNCLEN (CNLEN+2) /* UNC computer name length */
38: #endif /* CNLEN */
39:
40: // the choice of this char affects legal share,topic, etc. names
41: #define SEP_CHAR ','
42: #define BAR_CHAR "|"
43: #define SEP_WCHAR L','
44: #define BAR_WCHAR L"|"
45:
46: /* API error codes */
47: #define NDDE_NO_ERROR 0
48: #define NDDE_ACCESS_DENIED 1
49: #define NDDE_BUF_TOO_SMALL 2
50: #define NDDE_ERROR_MORE_DATA 3
51: #define NDDE_INVALID_SERVER 4
52: #define NDDE_INVALID_SHARE 5
53: #define NDDE_INVALID_PARAMETER 6
54: #define NDDE_INVALID_LEVEL 7
55: #define NDDE_INVALID_PASSWORD 8
56: #define NDDE_INVALID_ITEMNAME 9
57: #define NDDE_INVALID_TOPIC 10
58: #define NDDE_INTERNAL_ERROR 11
59: #define NDDE_OUT_OF_MEMORY 12
60: #define NDDE_INVALID_APPNAME 13
61: #define NDDE_NOT_IMPLEMENTED 14
62: #define NDDE_SHARE_ALREADY_EXIST 15
63: #define NDDE_SHARE_NOT_EXIST 16
64: #define NDDE_INVALID_FILENAME 17
65: #define NDDE_NOT_RUNNING 18
66: #define NDDE_INVALID_WINDOW 19
67: #define NDDE_INVALID_SESSION 20
68: #define NDDE_INVALID_ITEM_LIST 21
69: #define NDDE_SHARE_DATA_CORRUPTED 22
70: #define NDDE_REGISTRY_ERROR 23
71: #define NDDE_CANT_ACCESS_SERVER 24
72: #define NDDE_INVALID_SPECIAL_COMMAND 25
73: #define NDDE_INVALID_SECURITY_DESC 26
74: #define NDDE_TRUST_SHARE_FAIL 27
75:
76: /* string size constants */
77: #define MAX_NDDESHARENAME 256
78: #define MAX_USERNAME 15
79: #define MAX_DOMAINNAME 15
80: #define MAX_APPNAME 255
81: #define MAX_TOPICNAME 255
82: #define MAX_ITEMNAME 255
83:
84: /* connectFlags bits for ndde service affix */
85: #define NDDEF_NOPASSWORDPROMPT 0x0001
86: #define NDDEF_NOCACHELOOKUP 0x0002
87: #define NDDEF_STRIP_NDDE 0x0004
88:
89:
90: /* NDDESHAREINFO - contains information about a NDDE share */
91:
92: struct NDdeShareInfo_tag {
93: LONG lRevision;
94: LPTSTR lpszShareName;
95: LONG lShareType;
96: LPTSTR lpszAppTopicList;
97: LONG fSharedFlag;
98: LONG fService;
99: LONG fStartAppFlag;
100: LONG nCmdShow;
101: LONG qModifyId[2];
102: LONG cNumItems;
103: LPTSTR lpszItemList;
104: };
105: typedef struct NDdeShareInfo_tag NDDESHAREINFO;
106: typedef struct NDdeShareInfo_tag * PNDDESHAREINFO;
107:
108: /* Share Types */
109: #define SHARE_TYPE_OLD 0x01 // Excel|sheet1.xls
110: #define SHARE_TYPE_NEW 0x02 // ExcelWorksheet|sheet1.xls
111: #define SHARE_TYPE_STATIC 0x04 // ClipSrv|SalesData
112:
113:
114: /*
115: Add new share
116: */
117: UINT WINAPI
118: NDdeShareAddA (
119: LPSTR lpszServer, // server to execute on ( must be NULL )
120: UINT nLevel, // info level must be 2
121: PSECURITY_DESCRIPTOR pSD, // initial security descriptor (optional)
122: LPBYTE lpBuffer, // contains (NDDESHAREINFO) + data
123: DWORD cBufSize // sizeof supplied buffer
124: );
125:
126: UINT WINAPI
127: NDdeShareAddW (
128: LPWSTR lpszServer, // server to execute on ( must be NULL )
129: UINT nLevel, // info level must be 2
130: PSECURITY_DESCRIPTOR pSD, // initial security descriptor (optional)
131: LPBYTE lpBuffer, // contains (NDDESHAREINFO) + data
132: DWORD cBufSize // sizeof supplied buffer
133: );
134:
135: /*
136: Delete a share
137: */
138: UINT WINAPI
139: NDdeShareDelA (
140: LPSTR lpszServer, // server to execute on ( must be NULL )
141: LPSTR lpszShareName, // name of share to delete
142: UINT wReserved // reserved for force level (?) 0 for now
143: );
144:
145: UINT WINAPI
146: NDdeShareDelW (
147: LPWSTR lpszServer, // server to execute on ( must be NULL )
148: LPWSTR lpszShareName, // name of share to delete
149: UINT wReserved // reserved for force level (?) 0 for now
150: );
151:
152: /*
153: Get Share Security Descriptor
154: */
155:
156: UINT WINAPI
157: NDdeGetShareSecurityA(
158: LPSTR lpszServer, // server to execute on ( must be NULL )
159: LPSTR lpszShareName, // name of share to delete
160: SECURITY_INFORMATION si, // requested information
161: PSECURITY_DESCRIPTOR pSD, // address of security descriptor
162: DWORD cbSD, // size of buffer for security descriptor
163: LPDWORD lpcbsdRequired // address of required size of buffer
164: );
165:
166: UINT WINAPI
167: NDdeGetShareSecurityW(
168: LPWSTR lpszServer, // server to execute on ( must be NULL )
169: LPWSTR lpszShareName, // name of share to delete
170: SECURITY_INFORMATION si, // requested information
171: PSECURITY_DESCRIPTOR pSD, // address of security descriptor
172: DWORD cbSD, // size of buffer for security descriptor
173: LPDWORD lpcbsdRequired // address of required size of buffer
174: );
175:
176: /*
177: Set Share Security Descriptor
178: */
179:
180: UINT WINAPI
181: NDdeSetShareSecurityA(
182: LPSTR lpszServer, // server to execute on ( must be NULL )
183: LPSTR lpszShareName, // name of share to delete
184: SECURITY_INFORMATION si, // type of information to set
185: PSECURITY_DESCRIPTOR pSD // address of security descriptor
186: );
187:
188: UINT WINAPI
189: NDdeSetShareSecurityW(
190: LPWSTR lpszServer, // server to execute on ( must be NULL )
191: LPWSTR lpszShareName, // name of share to delete
192: SECURITY_INFORMATION si, // type of information to set
193: PSECURITY_DESCRIPTOR pSD // address of security descriptor
194: );
195:
196: /*
197: Enumerate shares
198: */
199: UINT WINAPI
200: NDdeShareEnumA (
201: LPSTR lpszServer, // server to execute on ( NULL for local )
202: UINT nLevel, // 0 for null separated 00 terminated list
203: LPBYTE lpBuffer, // pointer to buffer
204: DWORD cBufSize, // size of buffer
205: LPDWORD lpnEntriesRead, // number of names returned
206: LPDWORD lpcbTotalAvailable // number of bytes available
207: );
208:
209: UINT WINAPI
210: NDdeShareEnumW (
211: LPWSTR lpszServer, // server to execute on ( NULL for local )
212: UINT nLevel, // 0 for null separated 00 terminated list
213: LPBYTE lpBuffer, // pointer to buffer
214: DWORD cBufSize, // size of buffer
215: LPDWORD lpnEntriesRead, // number of names returned
216: LPDWORD lpcbTotalAvailable // number of bytes available
217: );
218:
219: /*
220: Get information on a share
221: */
222: UINT WINAPI
223: NDdeShareGetInfoA (
224: LPSTR lpszServer, // server to execute on ( must be NULL )
225: LPSTR lpszShareName, // name of share
226: UINT nLevel, // info level must be 2
227: LPBYTE lpBuffer, // gets struct containing (NDDESHAREINFO) + data
228: DWORD cBufSize, // sizeof buffer
229: LPDWORD lpnTotalAvailable, // number of bytes available
230: LPWORD lpnItems // item mask for partial getinfo (must be 0)
231: );
232:
233: UINT WINAPI
234: NDdeShareGetInfoW (
235: LPWSTR lpszServer, // server to execute on ( must be NULL )
236: LPWSTR lpszShareName, // name of share
237: UINT nLevel, // info level must be 2
238: LPBYTE lpBuffer, // gets struct containing (NDDESHAREINFO) + data
239: DWORD cBufSize, // sizeof buffer
240: LPDWORD lpnTotalAvailable, // number of bytes available
241: LPWORD lpnItems // item mask for partial getinfo (must be 0)
242: );
243:
244: /*
245: Modify DDE share data
246: */
247: UINT WINAPI
248: NDdeShareSetInfoA (
249: LPSTR lpszServer, // server to execute on ( must be NULL )
250: LPSTR lpszShareName, // name of share
251: UINT nLevel, // info level must be 2
252: LPBYTE lpBuffer, // points to struct with (NDDESHAREINFO) + data
253: DWORD cBufSize, // sizeof buffer
254: WORD sParmNum // Parameter index ( must be 0 - entire )
255: );
256:
257: UINT WINAPI
258: NDdeShareSetInfoW (
259: LPWSTR lpszServer, // server to execute on ( must be NULL )
260: LPWSTR lpszShareName, // name of share
261: UINT nLevel, // info level must be 2
262: LPBYTE lpBuffer, // points to struct with (NDDESHAREINFO) + data
263: DWORD cBufSize, // sizeof buffer
264: WORD sParmNum // Parameter index ( must be 0 - entire )
265: );
266:
267: /*
268: Set/Create a trusted share
269: */
270:
271: UINT WINAPI
272: NDdeSetTrustedShareA (
273: LPSTR lpszServer, // server to execute on ( must be NULL )
274: LPSTR lpszShareName, // name of share to delete
275: DWORD dwTrustOptions // trust options to apply
276: );
277:
278: UINT WINAPI
279: NDdeSetTrustedShareW (
280: LPWSTR lpszServer, // server to execute on ( must be NULL )
281: LPWSTR lpszShareName, // name of share to delete
282: DWORD dwTrustOptions // trust options to apply
283: );
284:
285: /* Trusted share options */
286: #define NDDE_TRUST_SHARE_START 0x80000000L // Start App Allowed
287: #define NDDE_TRUST_SHARE_INIT 0x40000000L // Init Conv Allowed
288: #define NDDE_TRUST_SHARE_DEL 0x20000000L // Delete Trusted Share (on set)
289: #define NDDE_TRUST_CMD_SHOW 0x10000000L // Use supplied cmd show
290: #define NDDE_CMD_SHOW_MASK 0x0000FFFFL // Command Show mask
291:
292: /*
293: Get a trusted share options
294: */
295:
296: UINT WINAPI
297: NDdeGetTrustedShareA (
298: LPSTR lpszServer, // server to execute on ( must be NULL )
299: LPSTR lpszShareName, // name of share to query
300: LPDWORD lpdwTrustOptions, // trust options in effect
301: LPDWORD lpdwShareModId0, // first word of share mod id
302: LPDWORD lpdwShareModId1 // second word of share mod id
303: );
304:
305: UINT WINAPI
306: NDdeGetTrustedShareW (
307: LPWSTR lpszServer, // server to execute on ( must be NULL )
308: LPWSTR lpszShareName, // name of share to query
309: LPDWORD lpdwTrustOptions, // trust options in effect
310: LPDWORD lpdwShareModId0, // first word of share mod id
311: LPDWORD lpdwShareModId1 // second word of share mod id
312: );
313:
314:
315: /*
316: Enumerate trusted shares
317: */
318: UINT WINAPI
319: NDdeTrustedShareEnumA (
320: LPSTR lpszServer, // server to execute on ( NULL for local )
321: UINT nLevel, // 0 for null separated 00 terminated list
322: LPBYTE lpBuffer, // pointer to buffer
323: DWORD cBufSize, // size of buffer
324: LPDWORD lpnEntriesRead, // number of names returned
325: LPDWORD lpcbTotalAvailable // number of bytes available
326: );
327:
328: UINT WINAPI
329: NDdeTrustedShareEnumW (
330: LPWSTR lpszServer, // server to execute on ( NULL for local )
331: UINT nLevel, // 0 for null separated 00 terminated list
332: LPBYTE lpBuffer, // pointer to buffer
333: DWORD cBufSize, // size of buffer
334: LPDWORD lpnEntriesRead, // number of names returned
335: LPDWORD lpcbTotalAvailable // number of bytes available
336: );
337:
338: /*
339: Convert error code to string value
340: */
341: UINT WINAPI
342: NDdeGetErrorStringA (
343: UINT uErrorCode, // Error code to get string for
344: LPSTR lpszErrorString, // buffer to hold error string
345: DWORD cBufSize // sizeof buffer
346: );
347:
348: UINT WINAPI
349: NDdeGetErrorStringW (
350: UINT uErrorCode, // Error code to get string for
351: LPWSTR lpszErrorString, // buffer to hold error string
352: DWORD cBufSize // sizeof buffer
353: );
354:
355: /*
356: Validate share name format
357: */
358: BOOL WINAPI
359: NDdeIsValidShareNameA (
360: LPSTR shareName
361: );
362:
363: BOOL WINAPI
364: NDdeIsValidShareNameW (
365: LPWSTR shareName
366: );
367:
368: /*
369: Validate application/topic list format
370: */
371: BOOL WINAPI
372: NDdeIsValidAppTopicListA (
373: LPSTR targetTopic
374: );
375:
376: BOOL WINAPI
377: NDdeIsValidAppTopicListW (
378: LPWSTR targetTopic
379: );
380:
381: UINT WINAPI
382: NDdeSpecialCommandA(
383: LPSTR lpszServer,
384: UINT nCommand,
385: LPBYTE lpDataIn,
386: UINT nBytesDataIn,
387: LPBYTE lpDataOut,
388: UINT *lpBytesDataOut
389: );
390:
391: UINT WINAPI
392: NDdeSpecialCommandW(
393: LPWSTR lpszServer,
394: UINT nCommand,
395: LPBYTE lpDataIn,
396: UINT nBytesDataIn,
397: LPBYTE lpDataOut,
398: UINT *lpBytesDataOut
399: );
400:
401: #ifdef UNICODE
402: #define NDdeShareAdd NDdeShareAddW
403: #define NDdeShareDel NDdeShareDelW
404: #define NDdeSetShareSecurity NDdeSetShareSecurityW
405: #define NDdeGetShareSecurity NDdeGetShareSecurityW
406: #define NDdeShareEnum NDdeShareEnumW
407: #define NDdeShareGetInfo NDdeShareGetInfoW
408: #define NDdeShareSetInfo NDdeShareSetInfoW
409: #define NDdeGetErrorString NDdeGetErrorStringW
410: #define NDdeIsValidShareName NDdeIsValidShareNameW
411: #define NDdeIsValidAppTopicList NDdeIsValidAppTopicListW
412: #define NDdeSetTrustedShare NDdeSetTrustedShareW
413: #define NDdeGetTrustedShare NDdeGetTrustedShareW
414: #define NDdeTrustedShareEnum NDdeTrustedShareEnumW
415: #define NDdeSpecialCommand NDdeSpecialCommandW
416: #else
417: #define NDdeShareAdd NDdeShareAddA
418: #define NDdeShareDel NDdeShareDelA
419: #define NDdeSetShareSecurity NDdeSetShareSecurityA
420: #define NDdeGetShareSecurity NDdeGetShareSecurityA
421: #define NDdeShareEnum NDdeShareEnumA
422: #define NDdeShareGetInfo NDdeShareGetInfoA
423: #define NDdeShareSetInfo NDdeShareSetInfoA
424: #define NDdeGetErrorString NDdeGetErrorStringA
425: #define NDdeIsValidShareName NDdeIsValidShareNameA
426: #define NDdeIsValidAppTopicList NDdeIsValidAppTopicListA
427: #define NDdeSetTrustedShare NDdeSetTrustedShareA
428: #define NDdeGetTrustedShare NDdeGetTrustedShareA
429: #define NDdeTrustedShareEnum NDdeTrustedShareEnumA
430: #define NDdeSpecialCommand NDdeSpecialCommandA
431: #endif
432:
433: #ifdef __cplusplus
434: }
435: #endif /* __cplusplus */
436:
437: #ifndef RC_INVOKED
438: #pragma pack()
439: #endif /* !RC_INVOKED */
440:
441: #endif /* _INC_NDDEAPI */
442:
443:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.