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.
 
 
 
 
 
 

89 lines
1.5 KiB

/*++
Copyright (C) Microsoft Corporation, 2000
Module Name:
Context.hxx
Abstract:
Defines common stuff for context handles.
Author:
Kamen Moutafov [KamenM]
Revision History:
--*/
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef _CONTEXT_H
#define _CONTEXT_H
// uncomment this for unit tests
//#define SCONTEXT_UNIT_TESTS
inline long GetRandomLong (void)
{
long RndNum;
// this is for unit tests only - ignore return value
(void) GenerateRandomNumber((unsigned char *)&RndNum, sizeof(long));
return RndNum;
}
class WIRE_CONTEXT;
extern WIRE_CONTEXT NullContext;
class WIRE_CONTEXT
{
public:
inline BOOL
IsNullContext (
void
)
{
return (RpcpMemoryCompare(this, &NullContext, sizeof(WIRE_CONTEXT)) == 0);
}
inline ULONGLONG
GetDebugULongLong1 (
void
)
{
return *((ULONGLONG UNALIGNED *)&ContextUuid);
}
inline ULONGLONG
GetDebugULongLong2 (
void
)
{
return *(((ULONGLONG UNALIGNED *)&ContextUuid) + 1);
}
inline void
SetToNull (
void
)
{
RpcpMemorySet(this, 0, sizeof(WIRE_CONTEXT));
}
inline void
CopyToBuffer (
OUT PVOID Buffer
)
{
RpcpMemoryCopy(Buffer, this, sizeof(WIRE_CONTEXT));
}
unsigned long ContextType;
UUID ContextUuid;
};
#endif