Blackshot Launcher[Includes Source]
Little project I made while I was bored. This is for European Blackshot, not Garena. Enjoy.
How to use
Edit the configuration file with the correct information, making sure path points to the directory in which blackshot.exe resides.
How to use
Edit the configuration file with the correct information, making sure path points to the directory in which blackshot.exe resides.
Code:
//Custom Blackshot Online Game Launcher made by ntoskrnl. 3/6/11
#include <windows.h>
#include <winsock.h>
#pragma comment(lib, "ws2_32")
#include <stdio.h>
struct AuthInfo
{
unsigned int num;
wchar_t auth[12];
};
bool GetAuth(AuthInfo* ai, wchar_t* username, wchar_t* password)
{
WSAData wsa;
SOCKET s;
sockaddr_in addr;
char buf[256];
int len;
int index;
if(WSAStartup(MAKEWORD(2,2), &wsa) != 0)
{
return 0;
}
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(s == INVALID_SOCKET)
{
WSACleanup();
return 0;
}
addr.sin_addr.S_un.S_addr = inet_addr("217.113.36.25");
addr.sin_port = htons(12110);
addr.sin_family = AF_INET;
if(connect(s, (sockaddr*)&addr, sizeof(addr)) != 0)
{
closesocket(s);
WSACleanup();
return 0;
}
memcpy(buf, "\x64\x00", 2);
len = wcslen(username);
memcpy(buf+2, &len, 4);
len *= 2;
memcpy(buf+6, username, len);
index = 6 + len;
len = wcslen(password);
memcpy(buf+index, &len, 4);
len *= 2;
memcpy(buf+index+4, password, len);
index += len + 4;
memcpy(buf+index, "\x01\x00\x00\x00", 4);
index += 4;
if(!send(s, "\x2c\x00\x00\x00", 4, 0))
{
closesocket(s);
WSACleanup();
return 0;
}
if(!send(s, buf, index, 0))
{
closesocket(s);
WSACleanup();
return 0;
}
if(!recv(s, buf, 256, 0))
{
closesocket(s);
WSACleanup();
return 0;
}
memset(ai->auth, 0, 12*2);
memcpy(&ai->num, buf+8, 4);
memcpy(&len, buf+12, 4);
memcpy(ai->auth, buf+16, len*2);
closesocket(s);
WSACleanup();
return 1;
}
int main()
{
AuthInfo ai;
wchar_t args[256], dir[256], path[256], username[18], password[18];
GetCurrentDirectoryW(256, dir);
wcscat_s(dir, 256, L"\\BlackshotGameLauncher.ini");
GetPrivateProfileStringW(L"info", L"username", NULL, username, 18, dir);
GetPrivateProfileStringW(L"info", L"password", NULL, password, 18, dir);
GetPrivateProfileStringW(L"info", L"path", L"C:\\Program Files\\BlackShot\\BlackShot\\system", path, 256, dir);
if(GetAuth(&ai, username, password) == 0)
{
printf("Error Retrieving Authentication Info\n");
return 2;
}
memset(args, 0, 512);
swprintf(args, 512, L"\"%ls\\blackshot.exe\" -id %ls -num %u -auth %ls -server 217.113.38.166 -Nation 1 -Language 0", path, username, ai.num, ai.auth);
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
memset(&si, 0, sizeof(si));
if(CreateProcess(NULL, args, NULL, NULL, FALSE, 0, NULL, path, &si, &pi) == 0)
{
printf("Error Creating Process: %d\n", GetLastError());
return 1;
}
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
}
BlackshotGameLauncher.zip

Who approved this.![=]](/forum/images/emotions/=].gif)