here is example to start sc2 w/o any launchers:
Code Select
procedure TForm1.Button1Click(Sender: TObject);
var
SInfo: STARTUPINFO;
PInfo: PROCESS_INFORMATION;
hFile: THandle;
Base: Pointer;
cur: Pointer;
PID: DWORD;
Started: boolean;
begin
ZeroMemory(@SInfo, SizeOf(SInfo));
SInfo.cb := SizeOf(SInfo);
ZeroMemory(@PInfo, SizeOf(PInfo));
if CreateProcess(PChar(exe), nil, nil, nil, false, CREATE_SUSPENDED, nil, PChar(Dir), SInfo, PInfo) then
begin
hFile := CreateFileMapping(INVALID_HANDLE_VALUE, nil, PAGE_EXECUTE_READWRITE, 0, $10000, 'StarCraft II IPC Mem');
if hFile <> INVALID_HANDLE_VALUE then
begin
Base := MapViewOfFile(hFile, FILE_MAP_ALL_ACCESS, 0, 0, $10000);
if Base <> nil then
begin
cur := Base;
ZeroMemory(cur, $10000);
inc(PByte(cur), $20);
PByte(cur)^ := $04;
PID := GetCurrentProcessId;
inc(PByte(cur), 8);
PDWord(cur)^ := PID;
inc(PByte(cur), 4);
PDWord(cur)^ := $00000001;
inc(PDWord(cur), 7);
PDWord(cur)^ := $00000002;
inc(PDWord(cur));
PDWord(cur)^ := $FFFFFFFF;
inc(PDWord(cur), 2);
PDWord(cur)^ := $FFFFFFFF;
inc(PDWord(cur), 2);
StrPCopy(PAnsiChar(cur), AnsiString(Map));
ResumeThread(Pinfo.hThread);
Started := false;
repeat
cur := Base;
inc(PByte(cur), $20);
if PByte(cur)^ = $05 then
begin
inc(PByte(cur), 4);
if PByte(cur)^ = $01 then
begin
PByte(cur)^ := 0;
Started := true;
end;
end;
until Started;
end;
end;
CloseHandle(hFile);
end;
CloseHandle(Pinfo.hThread);
CloseHandle(PInfo.hProcess);
end;