Part 1 1
Chapter1:Getting Around in the Networking Services Library 1
How the Networking Services Library Is Structured 2
How the Networking Services Library Is Designed 3
Chapter2: What s In This Volume? 5
Microsoft RPC Model 5
Installing The RPC Programming Environment 6
Building RPC Applications 6
Connecting the Client and the Server 6
Tutorial 6
IDL and ACF Files 6
Data and Language Features 6
Arrays and Pointers 6
Pipes 6
Binding and Handles 6
Memory Management 6
Serialization Services 6
Security 7
Installing and Configuring RPC Applications 7
Asynchronous RPC 7
RPC Message Queuing 7
Remote Procedure Calls Using HTTP 7
Samples 7
RPC Reference 7
Chapter3: Using Microsoft Reference Resources 9
The Microsoft Developer Network 10
Comparing MSDN with MSDN Online 11
MSDN Subscriptions 13
MSDN Library Subscription 13
MSDN Professional Subscription 14
MSDN Universal Subscription 14
Purchasing an MSDN Subscription 14
Using MSDN 15
Navigating MSDN 16
Quick Tips 18
Using MSDN Online 20
Navigating MSDN Online 22
MSDN Online Features 23
MSDN Online Registered Users 29
The Windows Programming Reference Series 30
Chapter 4:Finding the Developer Resources You Need 31
Developer Support 31
Online Resources 33
Internet Standards 34
Learning Products 35
Conferences 37
Other Resources 37
Chapter5: Avoiding Common RPC Programming Errors 39
Solution Summary 39
Common RPC Programming Errors 40
Pointer_default(unique)and embedded pointers 40
A valid switch_is value in an RPC-capable structure doesn t ensure a non-NULL pointer 41
A NULL DACL affords no protection 41
Call RpclmpersonateClient()before any security-relevant operation 42
Starting and stopping impersonation 43
Strings are only zero-terminated when declared with string in the .idl 44
Don t copy arbitrary length data into independently sized buffers 45
size-is may result in a zero-length structure 45
Calculations in a size-is or length_is specification are susceptible to overflow 46
Strict context handles 46
Part 2 47
Chapter 6:Microsoft RPC Model 47
The Programming Model 47
The Client-Server Model 49
The Compute-Server Model 51
How RPC Works 51
OSF Standards for RPC 53
Microsoft RPC Components 54
RPC Extends Client-Server Computing 55
Chapter 7:Installing the RPC Programming Environment 57
Developing 32-Bit Windows Applications 57
Developing Macintosh Client Applications 59
Chapter 8:Building RPC Applications 61
General Build Procedure 61
Developing the Interface 62
Generating Interface UUIDs 63
Using MIDL 64
Developing the Server 66
Developing the Client 67
Environment,Compiler,and API Set Choices 68
Exception Handling 69
Chapter 9:Connecting the Client and the Server 71
Essential RPC Binding Terminology 71
How the Server Prepares for a Connection 72
Registering the Interface 73
Creating Binding Information 73
Advertising the Server Program 74
Registering Endpoints 75
Listening for Client Calls 75
How the Client Establishes a Connection 76
Making a Remote Procedure Call 78
Finding the Server Host Computer 78
Finding the Server Program 79
Creating a Binding 79
Chapter 10:An RPC Tutorial 81
The Stand-Alone Application 81
Defining the Interface 82
Generating the UUID 82
The IDL File 83
The ACF File 83
Generating the Stub Files 84
The Client Application 86
The Server Application 88
Stopping the Server Application 90
Compiling and Linking 91
Running the Application 92
Chapter11: The IDL and ACF Files 93
The Interface Definition Language(IDL)File 93
The IDL Interface Header 94
The IDL Interface Body 95
The Application Configuration File(ACF) 96
The ACF Header 96
The ACF Body 96
MIDL Compiler Output 97
Chapter12: Data and Language Features 99
Strong Typing 99
Base Types 100
Signed and Unsigned Types 101
Wide-Character Types 101
Structures 101
Unions 101
Enumerated Types 103
Arrays 103
Function Attributes 103
Field Attributes 103
Three Pointer Types 104
Type Attributes 105
Directional (Parameter)Attributes 106
Data Representation 108
The transmit-as and represent-as Attributes 109
The transmit-as Attribute 109
The type-to-xmit Function 111
The type-from-xmit Function 112
The type-free-xmit Function 114
The type-free-inst Function 114
The represent-as Attribute 115
The named-type-from-local Function 118
The named-type-to-local Function 118
The named-type-free-local Function 118
The named-type-free-inst Function 118
The wire-marshal and user-marshal Attributes 119
The wire-marshal Attribute 119
The user-marshal Attribute 120
The type-UserSize Function 121
The type-UserMarshal Function 122
The type-UserUnmarshal Function 123
The type-UserFree Function 124
Marshaling Rules for user-marshal and wire-marshal 124
Chapter13:Arays and Pointers 127
Arrays and RPC 127
Kinds of Arrays 127
Fixed Arrays 127
Varying Arrays 128
Conformant Arrays 129
Array Attributes 130
MIDL Array Attributes Used in RPC 132
The [size-is] Attribute 132
The [length-is] Attribute 133
The [first-is] and [last-is] Attributes 133
The [max-is] Attribute 134
Combining Array Attributes 134
The [string] Attribute in Arrays 135
Multidimensional Arrays 135
Pointers and RPC 137
Kinds of Pointers 137
Reference Pointers 137
Unique Pointers 139
Full Pointers 140
Pointers and Memory Allocation 141
Default Pointer Types 142
Pointer Attribute Type Inheritance 143
Using Arrays, Strings, and Pointers 144
Counted Character Arrays 145
[in, out, size-is]Prototype 145
[in, size-is and out, size-is] Prototype 146
Strings 147
[in ,out, string]Prototype 148
[in, string] and [out, string] Prototype 149
Multiple Levels of Pointers 149
Chapter14: Pipes 151
Essential Pipe Terminology 151
The Pipe State 152
Defining Pipes in IDL Files 152
Client-Side Pipe Implementation 153
Implementing Input Pipes on the Client 154
Implementing Output Pipes on the Client 157
Server-Side Pipe Implementation 159
Implementing Input Pipes on the Server 159
Implementing Output Pipes on the Server 160
Rules for Multiple Pipes 161
Combining Pipe and Nonpipe Parameters 162
Chapter15: Binding and Handles 163
Binding Handles 163
Types of Binding Handles 163
Automatic Binding Handles 164
Implicit Binding Handles 165
Explicit Binding Handles 167
Primitive and Custom Binding Handles 167
Client-Side Binding 170
Selecting a Protocol Sequence 171
Finding Server Host Systems 172
Finding Endpoints 176
Server-Side Binding 177
Registering Interfaces 177
Specifying Protocol Sequences 186
Specifying Endpoints 187
Advertising Server Interfaces 189
Listening for Remote Procedure Calls 190
Fully and Partially Bound Handles 191
Interpreting Binding Information 191
Microsoft RPC Binding-Handle Extensions 193
Binding-Handle Functions 194
The RPC Name-Service Database 195
Name-Service Application Guidelines 196
An Overview of the Name Service Entry 197
Criteria for Name Service Entries 197
Name Service Entry Cleanup 198
What Happens During a Query 198
Using Microsoft Locator 199
Using the Cell Directory Service(CDS) 200
Name Syntax 201
Context Handles 201
Interface Development Using Context Handles 202
Server Development Using Context Handles 203
Client Development Using Context Handles 205
Server Context Rundown Routine 207
Client Context Reset 208
Multi-Threaded Clients and Context Handles 208
Chapter16: Memory Management 209
Introduction to RPC Memory Management 209
How Memory Is Allocated and Deallocated 210
The midl_user_allocate Function 210
The midl_user_free Function 211
RpcSs Memory Management Package 212
Memory-Management Models 213
Node-by Node Allocation and Deallocation 213
Stub-Allocated Buffers 214
Application-Allocated Buffer 214
Persistent Storage on the Server 215
Who Manages Memory? 216
Top-Level and Embedded Pointers 216
Directional Attributes Applied to the Parameter 216
Length, Size, and Directional Attributes 217
Pointer Attributes Applied to the Parameter 219
Combining Pointer and Directional Attributes 219
Embedded Out-Only Reference Pointers 219
Out-Only Unique or Full Pointer Parameters Not Accepted 220
Function Return Values 220
Memory Orphaning 221
Summary of Memory Allocation Rules 221
Chapter17: Serialization Services 223
Using Serialization Services 224
Procedure Serialization 225
Type Serialization 225
Serialization Handles 226
Implicit Versus Explicit Handles 227
Serialization Styles 227
Fixed Buffer Serialization 228
Dynamic Buffer Serialization 230
Incremental Serialization 230
Obtaining an Encoding Identity 233
Chapter18: Security 235
RPC Security Essentials 235
Principal Names 235
AuthenticationLevels 236
Authentication Services 237
Client Authentication Credentials 237
Authorization Services 237
Quality of Service 237
Authorization Functions 238
Key Acquisition Functions 239
Client Impersonation 239
Security Methods 240
Security Support Provider Interface(SSPI) 240
SSPI Architectural Overview 240
Security Support Providers(SSPs) 241
Writing an Authenticated SSPI Client 242
Writing an Authenticated SSPI Server 245
Windows NT and Windows 2000 Transport Security 246
Using Transport-Level Security on the Server 247
Using Transport-Level Security on the Client 247
Chapter19: Installing and Configuring RPC Applications 249
Configuring the Name Service Provider 249
Configuring the Name Service for Windows 95 250
Editing the Windows 95 Registry 250
Configuring the Name Service for Windows NT or Windows 2000 251
Configuring the Name Service for Windows 3.x of MS-DOS 252
Starting and Stopping Microsoft Locator 253
Registry Information 253
Using RPC Registry Entries 253
Configuring the Windows NT and Windows 2000 Registry for Port Allocations and Selective Binding 255
Using RPC with Winsock Proxy 257
SPX/IPX Installation 258
Configuring RPC for SPX/IPX 258
Configuring SAP and RPC 260
Configuring the Security Server 261
Chapter20: Asynchronous RPC 263
Declaring Asynchronous Functions 264
Client-Side Asynchronous RPC 264
Making the Asynchronous Call 265
Waiting for the Asynchronous Reply 267
Receiving the Asynchronous Reply 268
Server-Side Asynchronous RPC 269
Handling Asynchronous Calls 269
Receiving Cancellations 269
Sending the Asynchronous Reply 269
Asynchronous I/O and Asynchronous RPC 271
Causal Ordering of Asynchronous Calls 272
Error Handling 272
Asynchronous RPC Over the Named-Pipe Protocol 273
Using Asynchronous RPC with DCE Pipes 274
Asynchronous Pipes 274
Declaring Asynchronous Pipes 274
Client-Side Asynchronous Pipe Handling 275
Server-Side Asynchronous Pipe Handling 276
Asynchronous DCOM 280
Chapter 21:RPC Message Queuing 281
Overview of Message Queuing Services Architecture 281
Message and Message Queue Properties 283
Using MSMQ as an RPC Transport 283
System Requirements for RPC-MQ Applications 284
Developing RPC-MQ Applications 284
MSMQ Security Services 286
Chapter22: Remote Procedure Calls Using HTTP 287
Using HTTP as an RPC Transport 287
HTTP RPC Security 290
System Requirements for HTTP RPC 291
Configuring Computers for HTTP RPC 291
Chapter23: RPC Samples 293
Chapter24: RPC Data Types, Structures ,and Constants 295
RPC Structures 295
RPC Enumerated Types 315
Other RPC Types 316
RPC Constants 329
RPC Returr,Values 340
Chapter25: RPC Function Reference 347
RPC Functions 347
Chapter26: RPC Callback and Notification Functions 575
Chapter27: RPC Macros 583
Chapter28: Windows Networking(WNet) 591
About Windows Networking 591
WNet Functions 592
Windows Networking Operations 594
Using Windows Networking 595
Using the Connections Dialog Box 595
Enumerating Network Resources 595
Adding a Network Connection 599
Assigning a Drive to a Share 600
Determining the Location of a Share 601
Retrieving the Connection Name 603
Retrieving the User Name 604
Canceling a Network Connection 605
Retrieving Network Errors 606
Windows Networking Reference 608
Windows Networking Functions 608
Obsolete Functions 608
Windows Networking Structures 656
Part 3 669
Glossary 669
Index: Networking Services Programming Elements-Alphabetical Listing 677