41{
43 ULONG SubSystemType = ProcessInformation->ImageInformation.SubSystemType;
49
50
51 CreateSessionMsg->
ProcessInfo = *ProcessInformation;
53 if (DbgUiClientId)
54 {
56 }
57 else
58 {
61 }
62
63
66 {
67 NtClose(ProcessInformation->ProcessHandle);
68 NtClose(ProcessInformation->ThreadHandle);
71 }
72
73
75 if (KnownSubsys)
76 {
77
79 ProcessInformation->ProcessHandle,
83 0,
84 0);
86 {
87
89 ProcessInformation->ThreadHandle,
93 0,
94 0);
96 {
97
98 NtClose(ProcessInformation->ProcessHandle);
99 NtClose(ProcessInformation->ThreadHandle);
101 DPRINT1(
"SmpSbCreateSession: NtDuplicateObject (Thread) Failed %lx\n",
Status);
103 }
104
105
106 NtClose(ProcessInformation->ProcessHandle);
107 NtClose(ProcessInformation->ThreadHandle);
108
109
112
113
115 SbApiMsg.
h.u2.ZeroInit = 0;
117 SbApiMsg.
h.u1.s1.TotalLength =
sizeof(SbApiMsg);
122 {
123
124 DPRINT1(
"SmpSbCreateSession: NtRequestWaitReply Failed %lx\n",
Status);
125 }
126 else
127 {
128
130 }
131
132
134 }
135 else
136 {
137
138 DPRINT1(
"SmpSbCreateSession: NtDuplicateObject (Process) Failed %lx\n",
Status);
139 NtClose(ProcessInformation->ProcessHandle);
140 NtClose(ProcessInformation->ThreadHandle);
141 }
142
143
146 }
147
148
150 {
151
152#if DBG
154 CHAR SubSysTypeName[
sizeof(
"Type 0x")+8];
155
157 SubSysName = SmpSubSystemNames[SubSystemType];
158 if (!SubSysName)
159 {
160 SubSysName = SubSysTypeName;
161 sprintf(SubSysTypeName,
"Type 0x%08lx", SubSystemType);
162 }
163 DPRINT1(
"SMSS: %s SubSystem not found (either not started or destroyed).\n", SubSysName);
164#endif
166 NtClose(ProcessInformation->ProcessHandle);
167 NtClose(ProcessInformation->ThreadHandle);
169 }
170
171#if 0
172
173
174
175
176
177
179 {
182 {
183 DPRINT1(
"Unable to initialize debugging for Native App %lx.%lx -- out of memory\n",
184 ProcessInformation->ClientId.UniqueProcess,
185 ProcessInformation->ClientId.UniqueThread);
186 NtClose(ProcessInformation->ProcessHandle);
187 NtClose(ProcessInformation->ThreadHandle);
189 }
190
192 Process->ClientId = ProcessInformation->ClientId;
194 DPRINT1(
"Native Debug App %lx.%lx\n",
195 Process->ClientId.UniqueProcess,
196 Process->ClientId.UniqueThread);
197
203 }
204#endif
205
206
207 DPRINT(
"Subsystem active, starting thread\n");
208 NtClose(ProcessInformation->ProcessHandle);
210 NtClose(ProcessInformation->ThreadHandle);
212}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
#define NT_SUCCESS(StatCode)
#define InsertHeadList(ListHead, Entry)
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
#define sprintf(buf, format,...)
#define THREAD_ALL_ACCESS
#define PROCESS_ALL_ACCESS
#define NtCurrentProcess()
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define IMAGE_SUBSYSTEM_NATIVE
NTSTATUS NTAPI NtRequestWaitReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest, IN OUT PPORT_MESSAGE LpcReply)
NTSTATUS NTAPI NtSetInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength)
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
NTSTATUS NTAPI NtDuplicateObject(IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle OPTIONAL, OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG HandleAttributes, IN ULONG Options)
LIST_ENTRY NativeProcessList
struct _SB_CREATE_SESSION_MSG SB_CREATE_SESSION_MSG
NTSTATUS NTAPI SmpGetProcessMuSessionId(IN HANDLE ProcessHandle, OUT PULONG SessionId)
BOOLEAN NTAPI SmpCheckDuplicateMuSessionId(IN ULONG MuSessionId)
ULONG NTAPI SmpAllocateSessionId(IN PSMP_SUBSYSTEM Subsystem, IN PSMP_SUBSYSTEM OtherSubsystem)
VOID NTAPI SmpDeleteSession(IN ULONG SessionId)
VOID NTAPI SmpDereferenceSubsystem(IN PSMP_SUBSYSTEM SubSystem)
PSMP_SUBSYSTEM NTAPI SmpLocateKnownSubSysByType(IN ULONG MuSessionId, IN ULONG ImageType)
union _SB_API_MSG::@3526::@3528::@3530 u
SB_CREATE_SESSION_MSG CreateSession
RTL_USER_PROCESS_INFORMATION ProcessInfo
#define STATUS_UNSUCCESSFUL
#define STATUS_OBJECT_NAME_NOT_FOUND