1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/*++
Copyright (c) 1992-1993 Microsoft Corporation
Module Name:
nwmisc.h
Abstract:
Header which specifies the misc routines used by the workstation service.
Author:
Arnold Miller (arnoldm) 15-Feb-1996
Revision History:
--*/
#ifndef __RNRDEFS_H__
#define __RNRDEFS_H__
#include "sapcmn.h"
//
// Bit defs for the protocols
//
#define IPX_BIT 1
#define SPX_BIT 2
#define SPXII_BIT 4
//
// forwards\
//
struct _SAP_RNR_CONTEXT;
//
// Bindery control
//
typedef struct _BinderyControl
{
LONG lIndex;
} BINDERYCONTROL, *PBINDERYCONTROL;
//
// SAP RnR context information. This is linked off of the
// SAP_BCAST_CONTROL defined ahead
//
typedef struct _SAP_DATA
{
struct _SAP_DATA * sapNext;
// save everything except hop count
WORD sapid; // for a sanity check
CHAR sapname[48]; // what we don't know
BYTE socketAddr[IPX_ADDRESS_LENGTH]; // and what we seek
} SAP_DATA, *PSAP_DATA;
//
//
// Sap bcast control
// An important note. fFlags is set only by the thread executing
// a LookupServiceBegin or a LookupServiceNext. It may be tested by
// any thread. Its counterpart, dwControlFlags in SAP_RNR_CONTEXT
// is reserved for setting by LookupServiceBegin and LookupServiceEnd. Once
// again any thread may look at it. This insures no loss of data on an
// MP machine without needing a critical section.
//
typedef struct _SAP_BCAST_CONTROL
{
DWORD dwIndex; // loop control
DWORD dwTickCount; // tick count of last send
DWORD fFlags; // various flags
PVOID pvArg;
SOCKET s;
CRITICAL_SECTION csMonitor; // This is to keep
// out internal structures sane. Note
// it does not provide rational
// serialization. In particular, if
// multiple threads use the same
// handle simultaneously, there is no
// guaranteed serialization.
PSAP_DATA psdNext1; // next to return
PSAP_DATA psdHead; // list head
PSAP_DATA psdTail;
struct _SAP_RNR_CONTEXT * psrc; // need this
DWORD (*Func)(PVOID pvArg1, PSAP_IDENT_HEADER pSap, PDWORD pdwErr);
BOOL (*fCheckCancel)(PVOID pvArg1);
WORD wQueryType;
} SAP_BCAST_CONTROL, *PSAP_BCAST_CONTROL;
//
// Flags for above
#define SBC_FLAG_NOMORE 0x1
//
// Structure used by the old RnR Sap lookup as the pvArg value in
// SAP_BCAST control
//
#ifndef _NTDEF_
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
#ifdef MIDL_PASS
[size_is(MaximumLength), length_is(Length) ]
#endif // MIDL_PASS
PCHAR Buffer;
} OEM_STRING;
#endif
typedef struct _OldRnRSap
{
OEM_STRING * poem;
HANDLE hCancel;
LPVOID lpCsAddrBuffer;
LPDWORD lpdwBufferLength;
DWORD nProt;
LPDWORD lpcAddress;
} OLDRNRSAP, *POLDRNRSAP;
//
// Return codes from the coroutine
//
#define dwrcDone 1 // all done, return success
#define dwrcCancel 2 // all done, return cancelled
#define dwrcNoWait 3 // keep going, but never wait.
#define dwrcNil 4 // do whatever you want
//
// Sap service query packet format
//
typedef struct _SAP_REQUEST {
USHORT QueryType;
USHORT ServerType;
} SAP_REQUEST, *PSAP_REQUEST;
#define QT_GENERAL_QUERY 1
#define QT_NEAREST_QUERY 3
// The context information we put inside of an RNRNSHANDLE structure
// to keep track of what we are doing
// N.B. See comment on SAP_BCAST_CONTROL about the use of dwControlFlags.
//
typedef struct _SAP_RNR_CONTEXT
{
struct _SAP_RNR_CONTEXT * pNextContext;
LONG lSig;
LONG lInUse;
DWORD dwCount; // count of queries made
DWORD fFlags; // always nice to have
DWORD dwControlFlags;
DWORD fConnectionOriented;
WORD wSapId; // the type desired
HANDLE Handle; // the corresponding RnR handle
DWORD nProt;
GUID gdType; // the type we are seeking
GUID gdProvider;
HANDLE hServer;
WCHAR wszContext[48];
WCHAR chwName[48]; // the name, if any
CHAR chName[48]; // OEM form of the name for SAP
DWORD dwUnionType; // type of lookup, once we know
union
{
SAP_BCAST_CONTROL sbc;
BINDERYCONTROL bc;
} u_type;
PVOID pvVersion; // a trick to get the version here.
} SAP_RNR_CONTEXT, *PSAP_RNR_CONTEXT;
#define RNR_SIG 0xaabbccdd
//
// union types
//
#define LOOKUP_TYPE_NIL 0
#define LOOKUP_TYPE_SAP 1
#define LOOKUP_TYPE_BINDERY 2
#define SAP_F_END_CALLED 0x1 // generic cancel
//
// Defs for the bindery Class info
// BUGBUG. These probably should be elsewhere
// This defines the format of each ClassInfo property segement. It looks
// somewhat like an actual ClassInfo, but considerably compressed. Note
// due to marshalling problems, any complex value, such as a GUID,
// should be stored as a string and then imported. Hence, we define
// types for what we can anticipate.
//
typedef struct _BinderyClasses
{
BYTE bType;
BYTE bSizeOfType;
BYTE bSizeOfString;
BYTE bOffset; // where the data area begins
BYTE bFlags;
BYTE bFiller;
WORD wNameSpace; // the applicable namespace
CHAR cDataArea[120]; // where the type and string are placed
} BINDERYCLASSES, *PBINDERYCLASSES;
#define BT_DWORD 1 // DWORD
#define BT_WORD 2 // WORD
#define BT_GUID 3 // a string GUID (ASCII)
#define BT_STR 3 // an OEM string
#define BT_OID 4 // an object ID (TBD)
#define BT_BSTR 5 // a binary string (very dangerous)
#define BT_WSTR 6 // UNICODE string. Unmarshalled!
#define RNRTYPE "RNR_TYPE" // prop containing the GUID
#define RNRCLASSES "RNR_CLASSES" // the other property
#endif
|