| Applikationen Probleme mit Anwendungsprogrammen aller Art gehören hier hin. |
Diskussion: AutoLogin für Wacraft3, bitte test! im Forum Applikationen, in der Kategorie Software Home; Anzeige hi leute, habe heute endlich mein Programm zu ende geschrieben welches es einem erlleichter sich in das Bnet einzulogen, ...
![]() |
| | #1 (permalink) |
| Registriert seit: 08.07.07 ![]() Likes: 0 | Anzeige hi leute, habe heute endlich mein Programm zu ende geschrieben welches es einem erlleichter sich in das Bnet einzulogen, voll kommen automatisch und super schnell. Ich habe das Programm mehr mals schon getestet und bin sehr zu frieden mit meiner Arbeit :) *Eigenlob* Nun würde ich das Programm gerne unters Volk bringen und mich freun wenn ein paar WC3 gamer es für mich testen würden und mir hier vieleicht auch nen feedback schreiben würden dnake! Das Ding funktioniert nur unter Windoof :P also sorry für alle die kein MS Win haben. Hier der link zu meiner Datei: http://www.hostarea.de/server-08/August-0d314de4a8.rar Gruß Tobi. |
| | |
| | #2 (permalink) |
| Senior Member Registriert seit: 18.05.04 ![]() Likes: 0 | Ich würde dir ja gerne helfen, aber ich führe keine Setup.exe aus. Lade doch einfach den Quellcode hoch, wenn du nichts dagegen hast, damit es sich jeder selbst kompilieren kann.
__________________ Die neuen Desire Z und Desire HD Smartphones |
| | |
| HaBOT | - Anzeige - |
| |
| | #3 (permalink) |
| Themenstarter Registriert seit: 08.07.07 ![]() Likes: 0 | meinste is nen Virus ... dann kannse mich immer noch verklagen *g* |
| | |
| | #4 (permalink) |
| Registriert seit: 13.08.07 ![]() Likes: 2 | ...oder er hatt es auf den quellcode abgesehen |
| | |
| | #5 (permalink) |
| Registriert seit: 11.07.07 ![]() Likes: 0 | Ich kann ghostdog ehrlich gesagt schon verstehen, der quellcode wär tatsächlich besser. Vor allem ist es so, dass wenn es OpenSource ist es sich auch mehrere "Tester" bzw. "Anwender" finden würden. |
| | |
| | #6 (permalink) | |
| Senior Member Registriert seit: 03.09.05 ![]() Likes: 0 | Zitat:
| |
| | |
| | #7 (permalink) |
| Themenstarter Registriert seit: 08.07.07 ![]() Likes: 0 | kann ich verstehen xD hier mal noch nen thread http://forum.ingame.de/warcraft/show...46#post3669826 wie gesagt versuchts oder versuchts net... ich spiel eh nur dota von daher was soll ich mit euren acc ^^ Gruß Tobi. |
| | |
| | #8 (permalink) |
| Senior Member Registriert seit: 07.01.03 ![]() Likes: 19 | fakt ist, dass du wohl damit rechnen musst, dass niemand das ding starten will, weil niemand dem code vertrauen kann (gerade wenn es um daten wie account-login geht, wie Lesco schon sagte). und das ist auch gut so ![]() mit einer veröffentlichung des source-codes würdest du dem entgegenwirken. allerdings, wenn du es nicht veröffenltichen möchtest, dann hat das doch sicher seinen grund, oder? |
| | |
| | #9 (permalink) |
| Senior Member | habs mal ausprobiert, kann eh nich viel passieren ich fidns ehrlic hgesagt sher sher unklug das das pw im klartext in ner .ini gespeichert wird edit// es finktioniert auch nich wirklich, was tief blicken lassen könnte
__________________ fat people are hard to kidnap |
| | |
| | #10 (permalink) |
| Themenstarter Registriert seit: 08.07.07 ![]() Likes: 0 | jo hab auch shcon ne neue version hier http://www.hostarea.de/server-08/August-1ddb9cea7a.rar und ok hier habter den quelltext. Setup: Code:
#include <windows.h>
//--- Globals ------------------------------------------------------------------
HWND wc3_hWnd;
int clientX, clientY;
char path[ 256 ]; // contains the wc3 path
char user[ 17 ]; // contains the account-name
char pass[ 16 ]; // contains the password
char chan[ 128 ]; // contains your favourite channel you want join after login
bool next;
bool newAcc;
unsigned int timeout;
//--- Prototypes ---------------------------------------------------------------
void EnableDebugPrivilege( );
bool isReadyPainted( int, int, int, int );
void loadUserData( char *, char *, char *, char * );
void startWc3( );
HWND getWindowHandle( );
bool enterAccData( char *, char *, char * );
bool proofAccName( char * );
void simKey( char );
void decoder( char *, int );
void encoder( char *, int );
//--- WinMain ------------------------------------------------------------------
WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {
// ***** get the current screen sizes *****
clientX = GetSystemMetrics( SM_CXSCREEN );
clientY = GetSystemMetrics( SM_CYSCREEN );
// ***** empty all char buffer before we safe data there ;) *****
path[ 0 ] = 0;
user[ 0 ] = 0;
pass[ 0 ] = 0;
chan[ 0 ] = 0;
EnableDebugPrivilege( );
// ***** load all data *****
loadUserData( path, user, pass, chan );
// ***** start wc3 *****
startWc3( );
// ***** wait until wc3 window is ready painted after start up *****
wc3_hWnd = getWindowHandle( );
next = false;
timeout = 0;
do {
if( timeout == 20000 ) {
MessageBox( 0, "The screen needs to long to redrawn so the \"AutoLogin\" will terminate!",
"Warning!", MB_OK | MB_ICONWARNING );
return 0;
}
next = isReadyPainted( 1, 0, 0, 0 );
timeout += 100;
} while( !next );
Sleep( 50 );
// ***** click, to make sure that wc3 is foreground window *****
SetCursorPos( 0, 0 );
Sleep( 20 );
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
// ***** bnet login *****
SetCursorPos( clientX - ( clientX * 0.15 ), clientY - ( clientY * 0.67 ) );
Sleep( 20 );
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
Sleep( 1000 );
next = false;
timeout = 0;
do {
if( timeout == 20000 ) {
MessageBox( 0, "The screen needs to long to redrawn so the \"AutoLogin\" will terminate!",
"Warning!", MB_OK | MB_ICONWARNING );
return 0;
}
next = isReadyPainted( 2, 0, 0, 0 );
timeout += 100;
} while( !next );
// ***** enter all data *****
if( !( enterAccData( user, pass, chan ) ) ) {
MessageBox( 0, "The screen needs to long to redrawn so the \"AutoLogin\" will terminate!",
"Warning!", MB_OK | MB_ICONWARNING );
return 0;
}
return 0;
}
//--- Definitons ---------------------------------------------------------------
// ***** get more previleges, necessary for finding the wc3 window *****
void EnableDebugPrivilege( ) {
TOKEN_PRIVILEGES priv;
HANDLE hThis, hToken;
LUID luid;
hThis = GetCurrentProcess();
OpenProcessToken( hThis, TOKEN_ADJUST_PRIVILEGES, &hToken );
LookupPrivilegeValue( 0, "seDebugPrivilege", &luid );
priv.PrivilegeCount = 1;
priv.Privileges[ 0 ].Luid = luid;
priv.Privileges[ 0 ].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges( hToken, false, &priv, 0, 0, 0 );
CloseHandle( hToken );
CloseHandle( hThis );
}
// ***** load the user data and wc3 path from file *****
void loadUserData( char *szPath, char *szNick, char *szPass, char *szChan ) {
char szBufferThis[ 256 ];
char szBufferPath[ 256 ];
char szBufferNick[ 17 ];
char szBufferPass[ 16 ];
char szBufferChan[ 128 ];
// ***** empty all strings *****
szBufferThis[ 0 ] = 0;
szBufferPath[ 0 ] = 0;
szBufferNick[ 0 ] = 0;
szBufferPass[ 0 ] = 0;
szBufferChan[ 0 ] = 0;
// ***** get current dic ( fullpath ) *****
GetCurrentDirectory( sizeof( szBufferThis ), szBufferThis );
// ***** insert ini file name to fullpath *****
strcat( szBufferThis, "/userdata.ini" );
// ***** now we can create the ini file with all informations *****
GetPrivateProfileString( "WC3PATH", "Fullpath", "ERROR!", szBufferPath, 256, szBufferThis );
GetPrivateProfileString( "ACCOUNT", "Nickname", "ERROR!", szBufferNick, 16, szBufferThis );
GetPrivateProfileString( "ACCOUNT", "Password", "ERROR!", szBufferPass, 16, szBufferThis );
GetPrivateProfileString( "CHANNEL", "Channel", "ERROR!", szBufferChan, 128, szBufferThis );
encoder( szBufferNick, 3 );
encoder( szBufferPass, 7 );
// ***** proof wheter the account was changed *****
if( proofAccName( szBufferNick ) ) {
newAcc = true;
}
else {
newAcc = false;
}
strcpy( szPath, szBufferPath );
strcpy( szNick, szBufferNick );
strcpy( szPass, szBufferPass );
strcpy( szChan, szBufferChan );
}
// ***** start wc3 *****
void startWc3( ) {
ShellExecute( 0, "open", path, 0, 0, SW_SHOWDEFAULT );
}
// ***** get the handle of the wc3 window *****
HWND getWindowHandle( ) {
HWND wc_hWnd;
bool isFound = false;
int timeout = 0;
// ***** search warcraft3 window *****
do {
if( timeout == 25000 ) {
MessageBox( 0, "The game needs to long to start so the \"AutoLogin\" will terminate now!",
"Warning!", MB_OK | MB_ICONWARNING );
return 0;
}
wc_hWnd = FindWindow( 0, "Warcraft III" );
if( !wc_hWnd ) {
isFound = false;
}
else {
isFound = true;
}
Sleep( 500 );
timeout += 500;
} while( !isFound );
return wc_hWnd;
}
// ***** last step: enter all data full automatically *****
bool enterAccData( char *szAccName, char *szAccPassword, char *szChannelname ) {
if( newAcc ) {
// ***** set cursor position to "Account-Name" editbox
SetCursorPos( clientX - ( clientX * 0.8 ), clientY - ( clientY * 0.78 ) );
}
Sleep( 20 );
// ***** click ( to set the focus to the edit( nick ) ) *****
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
if( newAcc ) {
// ***** enter acc-name *****
for( int i = 0; i < (int)strlen( szAccName ); i++ ) {
simKey(szAccName[ i ] );
Sleep( 15 );
}
// ***** switch to password edit *****
keybd_event( VK_TAB, 0, 0, 0 );
keybd_event( VK_TAB, 0, KEYEVENTF_KEYUP, 0 );
Sleep( 25 );
}
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
// ***** enter acc-password *****
for( int i = 0; i < (int)strlen( szAccPassword ); i++ ) {
simKey( szAccPassword[ i ] );
Sleep( 15 );
}
// ***** simulate return ( confirm the nick/pw ) *****
keybd_event( VK_RETURN, 0, 0, 0 );
keybd_event( VK_RETURN, 0, KEYEVENTF_KEYUP, 0 );
Sleep( 1000 );
next = false;
timeout = 0;
do {
if( timeout == 20000 ) {
return false;
}
next = isReadyPainted( 3, 0, 0, 0 );
timeout += 100;
} while( !next );
// ***** setcursor pos to chat button *****
SetCursorPos( clientX - ( clientX * 0.14 ), clientY - ( clientY * 0.155 ) );
Sleep( 20 );
mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
Sleep( 1000 );
next = false;
timeout = 0;
do {
if( timeout == 20000 ) {
return false;
}
next = isReadyPainted( 4, 0, 0, 0 );
timeout += 100;
} while( !next );
// ***** befor enter chanelname, tipp '/j ' (command to join chanel ) *****
simKey( '/' );
Sleep( 15 );
simKey( 'j' );
Sleep( 15 );
simKey( ' ' );
Sleep( 15 );
// ***** enter channelname *****
for( int i = 0; i < (int)strlen( szChannelname ); i++ ) {
simKey( szChannelname[ i ] );
Sleep( 15 );
}
// ***** simulate return *****
keybd_event( VK_RETURN, 0, 0, 0 );
keybd_event( VK_RETURN, 0, KEYEVENTF_KEYUP, 0 );
// ***** READY! :) *****
SetCursorPos( clientX - ( clientX * 0.5 ), clientY - ( clientY * 0.5 ) );
return true;
}
void simKey( char ch ) {
SHORT scancode = VkKeyScan( ch );
BYTE vk = LOBYTE( scancode );
bool shift = ( scancode & 0x100 )!=0,
ctrl = ( scancode & 0x200 )!=0,
alt = ( scancode & 0x400 )!=0;
if ( shift ) keybd_event( VK_SHIFT, 0, 0, 0 );
if ( ctrl ) keybd_event( VK_CONTROL, 0, 0, 0 );
if ( alt ) keybd_event( VK_MENU, 0, 0, 0 );
keybd_event( vk, 0, 0, 0 );
keybd_event( vk, 0, KEYEVENTF_KEYUP, 0 );
if ( alt ) keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0 );
if ( ctrl ) keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0 );
if ( shift ) keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0 );
}
bool isReadyPainted( int index, int r, int g, int b ) {
bool isReady;
HDC hDC;
COLORREF rgb;
POINT pos;
switch( index ) {
// main menu
case 1: {
hDC = GetWindowDC( wc3_hWnd );
pos.x = clientX - ( clientX * 0.08f );
pos.y = clientY - ( clientY * 0.14f );
ScreenToClient( wc3_hWnd, &pos );
rgb = GetPixel( hDC, pos.x, pos.y );
if( ( r == GetRValue( rgb ) ) && ( g == GetGValue( rgb ) ) && ( b < GetBValue( rgb ) ) ) {
isReady = true;
Sleep( 200 );
}
else {
isReady = false;
}
ReleaseDC( wc3_hWnd, hDC );
break;
}
// Bnet login
case 2: {
hDC = GetWindowDC( wc3_hWnd );
pos.x = clientX - ( clientX * 0.08f );
pos.y = clientY - ( clientY * 0.14f );
ScreenToClient( wc3_hWnd, &pos );
rgb = GetPixel( hDC, pos.x, pos.y );
if( ( r == GetRValue( rgb ) ) && ( g == GetGValue( rgb ) ) && ( b < GetBValue( rgb ) ) ) {
isReady = true;
Sleep( 200 );
}
else {
isReady = false;
}
ReleaseDC( wc3_hWnd, hDC );
break;
}
// welcome screen
case 3: {
hDC = GetWindowDC( wc3_hWnd );
pos.x = clientX - ( clientX * 0.08f );
pos.y = clientY - ( clientY * 0.14f );
ScreenToClient( wc3_hWnd, &pos );
rgb = GetPixel( hDC, pos.x, pos.y );
if( ( r == GetRValue( rgb ) ) && ( g == GetGValue( rgb ) ) && ( b < GetBValue( rgb ) ) ) {
isReady = true;
Sleep( 200 );
}
else {
isReady = false;
}
ReleaseDC( wc3_hWnd, hDC );
break;
}
// chat
case 4: {
hDC = GetWindowDC( wc3_hWnd );
pos.x = clientX - ( clientX * 0.1 );
pos.y = clientY - ( clientY * 0.07 );
ScreenToClient( wc3_hWnd, &pos );
rgb = GetPixel( hDC, pos.x, pos.y );
if( ( r == GetRValue( rgb ) ) && ( g == GetGValue( rgb ) ) && ( b < GetBValue( rgb ) ) ) {
isReady = true;
Sleep( 200 );
}
else {
isReady = false;
}
ReleaseDC( wc3_hWnd, hDC );
break;
}
}
Sleep( 200 );
return isReady;
}
// ***** This func proof if the acc-name is new *****
bool proofAccName( char * szAccName ) {
bool isNew;
// ***** proof whether nick is marked *****
int i = (int)strlen( szAccName );
if( ( szAccName[ i -1 ] ) == 'X' ) {
szAccName[ i - 1 ] = '\0';
// ***** get current dic ( fullpath ) *****
char szBufferThis[ 512 ];
szBufferThis[ 0 ] = 0;
GetCurrentDirectory( sizeof( szBufferThis ), szBufferThis );
// ***** fix up a bug ( '\' to '/' ) *****
for( int i = 0; i < (int)strlen( szBufferThis ); i++ ) {
if( szBufferThis[ i ] == '\\' ) {
szBufferThis[ i ] = '/';
}
}
// ***** insert ini file name to fullpath *****
strcat( szBufferThis, "/userdata.ini" );
// ***** decode for saving *****
decoder( szAccName, 3 );
WritePrivateProfileString( "ACCOUNT", "Nickname", szAccName, szBufferThis );
// ***** encode it after saving *****
encoder( szAccName, 3 );
isNew = true;
}
else {
isNew = false;
}
return isNew;
}
// decode an array before it will saved *****
void decoder( char * szBuffer, int key ) {
int iLength = (int)strlen( szBuffer );
// ***** +( key * i ) *****
for( int i = 0; i < iLength; i++ ) {
szBuffer[ i ] += ( key * i );
}
}
// encode an array before it will loaded *****
void encoder( char * szBuffer, int key ) {
int iLength = (int)strlen( szBuffer );
// ***** -( key * i ) *****
for( int i = 0; i < iLength; i++ ) {
szBuffer[ i ] -= ( key * i );
}
}
//--- EXIT --------------------------------------------------------------------- Code:
//--- Includes -----------------------------------------------------------------
#include <windows.h>
#include <fstream>
#include <stdio.h>
using namespace std;
//--- Globals ------------------------------------------------------------------
#define ID_EDIT_WCPATH 1000
#define ID_EDIT_NICK 1001
#define ID_EDIT_PASS 1002
#define ID_EDIT_CHAN 1003
#define ID_BUTTON_SETUP 1004
#define ID_BUTTON_CANCEL 1005
char szAppName[ ] = "WC3 AutoLogIn Setup";
char szAppTitle[ ] = "WC3 Autologin setup";
//--- Prototypes ---------------------------------------------------------------
LRESULT CALLBACK WinProc( HWND, UINT, WPARAM, LPARAM );
HWND doCreateChild( HWND, char *, char *, DWORD, DWORD, int, HINSTANCE );
void saveUserData( HWND, HWND, HWND, HWND );
bool loadUserData( HWND, HWND, HWND, HWND );
void decoder( char *, int );
void encoder( char *, int );
//--- Main ---------------------------------------------------------------------
WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {
HWND hWnd;
WNDCLASS wc;
MSG msg;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( 0, IDI_APPLICATION );
wc.hCursor = LoadCursor( 0, IDC_ARROW );
wc.hbrBackground = (HBRUSH) GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = 0;
wc.lpszClassName = szAppName;
if( !( RegisterClass( &wc ) ) ) {
MessageBox( 0, "Couldn't register window!", "Shutdown error!", MB_OK | MB_ICONERROR );
return 0;
}
hWnd = CreateWindowEx( WS_EX_TOOLWINDOW,
szAppName, szAppTitle,
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 300,
0,
0,
hInstance,
0 );
if( !hWnd ) {
MessageBox( 0, "Couldn't create window!", "Shutdown error!", MB_OK | MB_ICONERROR );
return 0;
}
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
while( GetMessage( &msg, 0, 0, 0 ) ) {
if( IsDialogMessage( hWnd, &msg ) ) {
}
else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
return( msg.wParam );
}
//--- Definitions --------------------------------------------------------------
LRESULT CALLBACK WinProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
HINSTANCE hInst;
static HWND hEdit1, hEdit2, hEdit3, hEdit4;
static HWND hButton1, hButton2;
static bool isFilled[ 4 ];
switch( message ) {
case WM_CREATE: {
hInst = ( ( LPCREATESTRUCT )lParam )->hInstance;
hEdit1 = doCreateChild( hWnd, "EDIT", "C:\\Programme\\Warcraft III\\Frozen Throne.exe", WS_EX_CLIENTEDGE, ES_AUTOHSCROLL | WS_TABSTOP, ID_EDIT_WCPATH, hInst );
hEdit2 = doCreateChild( hWnd, "EDIT", 0, WS_EX_CLIENTEDGE, WS_TABSTOP, ID_EDIT_NICK, hInst );
hEdit3 = doCreateChild( hWnd, "EDIT", 0, WS_EX_CLIENTEDGE, ES_PASSWORD | WS_TABSTOP, ID_EDIT_PASS, hInst );
hEdit4 = doCreateChild( hWnd, "EDIT", "Frozen Throne Deu-1", WS_EX_CLIENTEDGE, ES_AUTOHSCROLL | WS_TABSTOP, ID_EDIT_CHAN, hInst );
hButton1 = doCreateChild( hWnd, "BUTTON", "Setup!", 0, WS_TABSTOP, ID_BUTTON_SETUP, hInst );
hButton2 = doCreateChild( hWnd, "BUTTON", "Cancel", 0, WS_TABSTOP, ID_BUTTON_CANCEL, hInst );
SendMessage( hEdit2, EM_SETLIMITTEXT, 15, 0 );
SendMessage( hEdit3, EM_SETLIMITTEXT, 15, 0 );
SendMessage( hEdit3, EM_SETPASSWORDCHAR, (WPARAM)'#', 0 );
if( loadUserData( hEdit1, hEdit2, hEdit3, hEdit4 ) ) {
}
else {
for( int i = 0; i < 4; i++ ) {
isFilled[ i ] = false;
}
isFilled[ 0 ] = true;
isFilled[ 3 ] = true;
EnableWindow( hButton1, false );
SetFocus( hEdit2 );
}
return 0;
}
case WM_SIZE: {
MoveWindow( hEdit1, 10, 30, 275, 20, true );
MoveWindow( hEdit2, 10, 80, 150, 20, true );
MoveWindow( hEdit3, 10, 130, 150, 20, true );
MoveWindow( hEdit4, 10, 180, 275, 20, true );
MoveWindow( hButton1, 10, 230, 120, 30, true );
MoveWindow( hButton2, 165, 230, 120, 30, true );
return 0;
}
case WM_COMMAND: {
switch( LOWORD( wParam ) ) {
case ID_EDIT_WCPATH: {
switch( HIWORD( wParam ) ) {
case EN_UPDATE: {
if( ( SendMessage( hEdit1, WM_GETTEXTLENGTH, 0, 0 ) ) == 0 ) {
isFilled[ 0 ] = false;
EnableWindow( hButton1, false );
}
else {
isFilled[ 0 ] = true;
if( isFilled[ 0 ] && isFilled[ 1 ] && isFilled[ 2 ] && isFilled[ 3 ] ) {
EnableWindow( hButton1, true );
}
}
break;
}
}
break;
}
case ID_EDIT_NICK: {
switch( HIWORD( wParam ) ) {
case EN_UPDATE: {
if( ( SendMessage( hEdit2, WM_GETTEXTLENGTH, 0, 0 ) ) == 0 ) {
isFilled[ 1 ] = false;
EnableWindow( hButton1, false );
}
else {
isFilled[ 1 ] = true;
if( isFilled[ 0 ] && isFilled[ 1 ] && isFilled[ 2 ] && isFilled[ 3 ] ) {
EnableWindow( hButton1, true );
}
}
break;
}
}
break;
}
case ID_EDIT_PASS: {
switch( HIWORD( wParam ) ) {
case EN_UPDATE: {
if( ( SendMessage( hEdit3, WM_GETTEXTLENGTH, 0, 0 ) ) == 0 ) {
isFilled[ 2 ] = false;
EnableWindow( hButton1, false );
}
else {
isFilled[ 2 ] = true;
if( isFilled[ 0 ] && isFilled[ 1 ] && isFilled[ 2 ] && isFilled[ 3 ] ) {
EnableWindow( hButton1, true );
}
}
break;
}
}
break;
}
case ID_EDIT_CHAN: {
switch( HIWORD( wParam ) ) {
case EN_UPDATE: {
if( ( SendMessage( hEdit4, WM_GETTEXTLENGTH, 0, 0 ) ) == 0 ) {
isFilled[ 3 ] = false;
EnableWindow( hButton1, false );
}
else {
isFilled[ 3 ] = true;
if( isFilled[ 0 ] && isFilled[ 1 ] && isFilled[ 2 ] && isFilled[ 3 ] ) {
EnableWindow( hButton1, true );
}
}
break;
}
}
break;
}
case ID_BUTTON_SETUP: {
switch( HIWORD( wParam ) ) {
case BN_CLICKED: {
saveUserData( hEdit1, hEdit2, hEdit3, hEdit4 );
if( ( MessageBox( 0, "Do You want start \"AutoLogin\" now?", "Run it now?", MB_OKCANCEL | MB_ICONINFORMATION ) ) == IDOK ) {
ShellExecute( 0, "open", "AutoLogin.exe", 0, 0, SW_SHOWDEFAULT );
SendMessage( hWnd, WM_CLOSE, 0, 0 );
}
else {
SendMessage( hWnd, WM_CLOSE, 0, 0 );
}
break;
}
}
break;
}
case ID_BUTTON_CANCEL: {
switch( HIWORD( wParam ) ) {
case BN_CLICKED: {
SendMessage( hWnd, WM_CLOSE, 0, 0 );
break;
}
}
break;
}
}
return 0;
}
case WM_PAINT: {
HDC hDC;
PAINTSTRUCT ps;
hDC = BeginPaint( hWnd, &ps );
SetBkColor( hDC, TRANSPARENT );
SetTextColor( hDC, RGB( 255, 180, 0 ) );
TextOut( hDC, 10, 12, "Wc3 fullpath + exception name:", 30 );
TextOut( hDC, 10, 62, "Account-Name:", 13 );
TextOut( hDC, 10, 112, "Password:", 9 );
TextOut( hDC, 10, 162, "Favorite channel you want join:", 31 );
SetTextColor( hDC, RGB( 255, 0, 0 ) );
TextOut( hDC, 180, 80, "(max. 16 letters)", 17 );
TextOut( hDC, 180, 131, "(max. 16 letters)", 17 );
EndPaint( hWnd, &ps );
return 0;
}
case WM_DESTROY: {
PostQuitMessage( 0 );
return 0;
}
}
return( DefWindowProc( hWnd, message, wParam, lParam ) );
}
HWND doCreateChild( HWND hParent, char *szClassName, char *szTitle, DWORD exStyle, DWORD Style, int ID, HINSTANCE hInst ) {
HWND hChild = CreateWindowEx( exStyle,
szClassName, szTitle,
WS_CHILD | WS_VISIBLE |Style,
0, 0, 0, 0,
hParent,
(HMENU)ID,
hInst,
0 );
return( (HWND) hChild );
}
void saveUserData( HWND hEdit1, HWND hEdit2, HWND hEdit3, HWND hEdit4 ) {
char szBufferThis[ 256 ];
char szBufferPath[ 256 ];
char szBufferNick[ 17 ];
char szBufferPass[ 16 ];
char szBufferChan[ 128 ];
// ***** empty all strings *****
szBufferThis[ 0 ] = 0;
szBufferPath[ 0 ] = 0;
szBufferNick[ 0 ] = 0;
szBufferPass[ 0 ] = 0;
szBufferChan[ 0 ] = 0;
// ***** get current dic ( fullpath ) *****
GetCurrentDirectory( sizeof( szBufferThis ), szBufferThis );
// ***** fix up a bug ( '\' to '/' ) *****
for( int i = 0; i < (int)strlen( szBufferThis ); i++ ) {
if( szBufferThis[ i ] == '\\' ) {
szBufferThis[ i ] = '/';
}
}
// ***** insert ini file name to fullpath *****
strcat( szBufferThis, "/userdata.ini" );
// ***** now get all necessary informations from edits *****
SendMessage( hEdit1,
WM_GETTEXT,
(int)( SendMessage( hEdit1, WM_GETTEXTLENGTH, 0, 0 ) + 1 ),
(long)szBufferPath );
SendMessage( hEdit2,
WM_GETTEXT,
(int)( SendMessage( hEdit2, WM_GETTEXTLENGTH, 0, 0 ) + 1 ),
(long)szBufferNick );
SendMessage( hEdit3,
WM_GETTEXT,
(int)( SendMessage( hEdit3, WM_GETTEXTLENGTH, 0, 0 ) + 1 ),
(long)szBufferPass );
SendMessage( hEdit4,
WM_GETTEXT,
(int)( SendMessage( hEdit4, WM_GETTEXTLENGTH, 0, 0 ) + 1 ),
(long)szBufferChan );
// ***** proof nick and mark nick that autologin has to to wirte him *****
char szBuffer[ 17 ];
szBuffer[ 0 ] = 0;
GetPrivateProfileString( "ACCOUNT", "Nickname", "Error!", szBuffer, sizeof( szBuffer ), szBufferThis );
encoder( szBuffer, 3 );
// ***** nickname is not the same *****
if( ( strcmp( szBuffer, szBufferNick ) ) != 0 ) {
if( ( (int)strlen( szBuffer ) ) != 0 ) {
strcat( szBufferNick, "X" );
}
}
// ***** now we can create the ini file with all informations *****
WritePrivateProfileString( "WC3PATH", "Fullpath", szBufferPath, szBufferThis );
decoder( szBufferNick, 3 );
WritePrivateProfileString( "ACCOUNT", "Nickname", szBufferNick, szBufferThis );
decoder( szBufferPass, 7 );
WritePrivateProfileString( "ACCOUNT", "Password", szBufferPass, szBufferThis );
WritePrivateProfileString( "CHANNEL", "Channel", szBufferChan, szBufferThis );
}
bool loadUserData( HWND hEdit1, HWND hEdit2, HWND hEdit3, HWND hEdit4 ) {
// ***** proof whether the file exist *****
ifstream file;
file.open( "userdata.ini", ios::in );
if( !( file.good( ) ) ) {
// ***** if not?, close and quit here *****
file.close( );
return false;
}
// ***** else load all data *****
char szBufferThis[ 256 ];
char szBufferPath[ 256 ];
char szBufferNick[ 17 ];
char szBufferPass[ 16 ];
char szBufferChan[ 128 ];
// ***** empty all strings *****
szBufferThis[ 0 ] = 0;
szBufferPath[ 0 ] = 0;
szBufferNick[ 0 ] = 0;
szBufferPass[ 0 ] = 0;
szBufferChan[ 0 ] = 0;
// ***** get current dic ( fullpath ) *****
GetCurrentDirectory( sizeof( szBufferThis ), szBufferThis );
// ***** fix up a bug ( '\' to '/' ) *****
for( int i = 0; i < (int)strlen( szBufferThis ); i++ ) {
if( szBufferThis[ i ] == '\\' ) {
szBufferThis[ i ] = '/';
}
}
// ***** insert ini file name to fullpath *****
strcat( szBufferThis, "/userdata.ini" );
// ***** now we can proof if the ini file exist and read all informations *****
GetPrivateProfileString( "WC3PATH", "Fullpath", "Error!", szBufferPath, sizeof( szBufferPath ), szBufferThis );
GetPrivateProfileString( "ACCOUNT", "Nickname", "Error!", szBufferNick, sizeof( szBufferNick ), szBufferThis );
GetPrivateProfileString( "ACCOUNT", "Password", "Error!", szBufferPass, sizeof( szBufferPass ), szBufferThis );
GetPrivateProfileString( "CHANNEL", "Channel", "Error!", szBufferChan, sizeof( szBufferChan ), szBufferThis );
encoder( szBufferNick, 3 );
encoder( szBufferPass, 7 );
// ***** if nick is marked remove last char ( 'X' ) *****
int i = (int)strlen( szBufferNick );
if( ( szBufferNick[ i -1 ] ) == 'X' ) {
szBufferNick[ i - 1 ] = '\0';
}
// ***** now set all necessary informations from edits *****
SendMessage( hEdit1, WM_SETTEXT, 0, (long)szBufferPath );
SendMessage( hEdit2, WM_SETTEXT, 0, (long)szBufferNick );
SendMessage( hEdit3, WM_SETTEXT, 0, (long)szBufferPass );
SendMessage( hEdit4, WM_SETTEXT, 0, (long)szBufferChan );
// ***** now its done *****
return true;
}
// decode an array before it will saved *****
void decoder( char * szBuffer, int key ) {
int iLength = (int)strlen( szBuffer );
// ***** +( key * i ) *****
for( int i = 0; i < iLength; i++ ) {
szBuffer[ i ] += ( key * i );
}
}
// encode an array before it will loaded *****
void encoder( char * szBuffer, int key ) {
int iLength = (int)strlen( szBuffer );
// ***** -( key * i ) *****
for( int i = 0; i < iLength; i++ ) {
szBuffer[ i ] -= ( key * i );
}
}
//--- EXIT --------------------------------------------------------------------- gL & HF Gruß Tobi. |
| | |
![]() |
| - Anzeige - | |
| |
| Themen-Optionen | |
| Ansicht | |
| |
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Autologin Script o.Ä | Fabian | Code Kitchen | 27 | 25.09.07 17:56 |
| root autologin in Runlevel 3? | Apt Pupil | Linux/UNIX | 3 | 11.09.05 20:48 |
| Autologin für FireFox | maedmexx | Internet Allgemein | 5 | 17.06.05 16:48 |
| Gibts jemanden der fürs Handy was Programmieren kann?? bitte bitte | VB.Perl | Code Kitchen | 3 | 19.05.05 14:30 |
| Bitte um BETA-Test eines PHP Scripts | boppy | (Web-) Design und webbasierte Sprachen | 11 | 14.11.01 23:20 |