57 ULONG ConnectionInfoLength =
sizeof(ConnectionInfo);
62 PortNameLength = ((
wcslen(ObjectDirectory) + 1) *
sizeof(
WCHAR)) +
66 DPRINT1(
"PortNameLength too big: %Iu\n", PortNameLength);
97 DPRINT1(
"Failure allocating CSR Section\n");
102 LpcWrite.
Length =
sizeof(LpcWrite);
105 LpcWrite.
ViewSize = CsrSectionViewSize.
u.LowPart;
108 LpcRead.
Length =
sizeof(LpcRead);
135 DPRINT1(
"Couldn't allocate SID\n");
149 &ConnectionInfoLength);
155 DPRINT1(
"Couldn't connect to CSR port\n");
181 DPRINT1(
"Couldn't create heap for CSR port\n");
206 DPRINT(
"CsrClientConnectToServer: %lx %p\n", ServerId, ConnectionInfo);
209 if (ConnectionInfo && (!ConnectionInfoSize || !*ConnectionInfoSize))
211 DPRINT1(
"Connection info given, but no length\n");
219 if (ServerToServerCall) *ServerToServerCall =
TRUE;
252 &CsrServerRoutineName,
282 DPRINT1(
"Failure to connect to CSR\n");
293 if (CaptureBuffer ==
NULL)
311 sizeof(*ClientConnect));
316 *ConnectionInfoSize);
340typedef struct _TEST_EMBEDDED
355C_ASSERT(
sizeof(TEST_EMBEDDED) == 0xC);
382 ApiMessage->Header.u2.ZeroInit = 0;
392 ApiMessage->ApiNumber = ApiNumber;
393 ApiMessage->CsrCaptureData =
NULL;
395 DPRINT(
"API: %lx, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n",
397 ApiMessage->Header.u1.s1.DataLength,
398 ApiMessage->Header.u1.s1.TotalLength);
417 CaptureBuffer->BufferEnd =
NULL;
424 PointerCount = CaptureBuffer->PointerCount;
425 OffsetPointer = CaptureBuffer->PointerOffsetsArray;
426 while (PointerCount--)
428 if (*OffsetPointer != 0)
440 &ApiMessage->Header);
457 PointerCount = CaptureBuffer->PointerCount;
458 OffsetPointer = CaptureBuffer->PointerOffsetsArray;
459 while (PointerCount--)
461 if (*OffsetPointer != 0)
475 ApiMessage->Status =
Status;
481 DPRINT(
"Server-to-server call\n");
493 ApiMessage->Status =
Status;
498 DPRINT(
"Got back: 0x%lx\n", ApiMessage->Status);
499 return ApiMessage->Status;
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
static UNICODE_STRING PortName
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define CSR_CREATE_API_NUMBER(ServerId, ApiId)
#define CSRSRV_SERVERDLL_INDEX
struct _CSR_CAPTURE_BUFFER * PCSR_CAPTURE_BUFFER
#define CSR_CSRSS_SECTION_SIZE
#define NT_SUCCESS(StatCode)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
GLfloat GLfloat GLfloat GLfloat h
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI LdrGetDllHandle(_In_opt_ PWSTR DllPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *DllHandle)
NTSTATUS NTAPI LdrGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress)
NTSYSAPI PVOID NTAPI RtlFreeSid(_In_ _Post_invalid_ PSID Sid)
#define SECTION_ALL_ACCESS
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI PVOID NTAPI RtlCreateHeap(IN ULONG Flags, IN PVOID HeapBase OPTIONAL, IN ULONG ReserveSize OPTIONAL, IN ULONG CommitSize OPTIONAL, IN PVOID Lock OPTIONAL, IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define UNICODE_STRING_MAX_BYTES
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
#define IMAGE_SUBSYSTEM_NATIVE
NTSTATUS NTAPI NtSecureConnectPort(OUT PHANDLE PortHandle, IN PUNICODE_STRING PortName, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos, IN OUT PPORT_VIEW ClientView OPTIONAL, IN PSID ServerSid OPTIONAL, IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL, OUT PULONG MaxMessageLength OPTIONAL, IN OUT PVOID ConnectionInformation OPTIONAL, IN OUT PULONG ConnectionInformationLength OPTIONAL)
NTSTATUS NTAPI NtRequestWaitReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest, IN OUT PPORT_MESSAGE LpcReply)
#define STATUS_INVALID_IMAGE_FORMAT
#define STATUS_NAME_TOO_LONG
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
PCSR_CAPTURE_BUFFER NTAPI CsrAllocateCaptureBuffer(_In_ ULONG ArgumentCount, _In_ ULONG BufferSize)
VOID NTAPI CsrFreeCaptureBuffer(_In_ _Frees_ptr_ PCSR_CAPTURE_BUFFER CaptureBuffer)
VOID NTAPI CsrCaptureMessageBuffer(_Inout_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_opt_ PVOID MessageBuffer, _In_ ULONG MessageLength, _Out_ PVOID *CapturedData)
PVOID SharedStaticServerData
union _CSR_API_MESSAGE::@3482::@3484::@3486 Data
CSR_CLIENT_CONNECT CsrClientConnect
SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
ULONG_PTR CsrPortMemoryDelta
NTSTATUS(NTAPI * PCSR_SERVER_API_ROUTINE)(_In_ PCSR_API_MESSAGE Request, _Inout_ PCSR_API_MESSAGE Reply)
HANDLE NTAPI CsrGetProcessId(VOID)
static NTSTATUS CsrpConnectToServer(_In_ PCWSTR ObjectDirectory)
NTSTATUS NTAPI CsrClientConnectToServer(_In_ PCWSTR ObjectDirectory, _In_ ULONG ServerId, _In_ PVOID ConnectionInfo, _Inout_ PULONG ConnectionInfoSize, _Out_ PBOOLEAN ServerToServerCall)
PCSR_SERVER_API_ROUTINE CsrServerApiRoutine
NTSTATUS NTAPI CsrClientCallServer(_Inout_ PCSR_API_MESSAGE ApiMessage, _Inout_opt_ PCSR_CAPTURE_BUFFER CaptureBuffer, _In_ CSR_API_NUMBER ApiNumber, _In_ ULONG DataLength)
#define FIELD_OFFSET(t, f)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
struct _LARGE_INTEGER::@2299 u
#define SECURITY_LOCAL_SYSTEM_RID
#define SECURITY_NT_AUTHORITY
#define SECURITY_DYNAMIC_TRACKING