version 1.5, 2009/08/25 08:01:03 |
version 1.7, 2013/08/30 18:18:11 |
|
|
LONG ret; |
LONG ret; |
HKEY hOpenKey; |
HKEY hOpenKey; |
DWORD Type,dw; |
DWORD Type,dw; |
char dir[BUFSIZ],message[BUFSIZ]; |
char dir[BUFSIZ],message[BUFSIZ],engine[BUFSIZ]; |
char *slash; |
char *slash; |
int ldir; |
size_t ldir; |
static char rootdir[BUFSIZ]; |
static char rootdir[BUFSIZ]; |
static int rootdir_is_initialized; |
static int rootdir_is_initialized; |
|
|
|
|
return TRUE; |
return TRUE; |
} |
} |
|
|
|
if(GetModuleFileName(NULL,dir,BUFSIZ)) { |
|
slash = strrchr(dir,'\\'); |
|
*slash = 0; |
|
sprintf(engine,"%s\\engine.exe", dir); |
|
if ( access(engine,0) >= 0 ) { |
|
slash = strrchr(dir,'\\'); |
|
if ( slash ) { |
|
*slash = 0; |
|
} |
|
use_current_dir = 1; |
|
strcpy(rootdir,dir); |
|
strcpy(name,dir); |
|
rootdir_is_initialized = 1; |
|
return TRUE; |
|
} |
|
} |
GetCurrentDirectory(BUFSIZ,dir); |
GetCurrentDirectory(BUFSIZ,dir); |
slash = strrchr(dir,'\\'); |
slash = strrchr(dir,'\\'); |
if ( slash ) |
if ( slash ) |
|
|
NULL); |
NULL); |
return FALSE; |
return FALSE; |
} |
} |
if ( ret = RegSetValueEx(hOpenKey,"Directory",NULL,REG_SZ,dir,ldir) ) { |
if ( ret = RegSetValueEx(hOpenKey,"Directory",0,REG_SZ,dir,ldir) ) { |
FormatMessage( |
FormatMessage( |
FORMAT_MESSAGE_FROM_SYSTEM | |
FORMAT_MESSAGE_FROM_SYSTEM | |
FORMAT_MESSAGE_IGNORE_INSERTS, |
FORMAT_MESSAGE_IGNORE_INSERTS, |
|
|
strcpy(rootdir,name); |
strcpy(rootdir,name); |
rootdir_is_initialized = 1; |
rootdir_is_initialized = 1; |
return TRUE; |
return TRUE; |
|
} |
|
|
|
const char *get_helpdir() { |
|
static char helpdir[BUFSIZ]; |
|
static int helpdir_is_initialized; |
|
char lang[BUFSIZ]; |
|
char file[BUFSIZ]; |
|
char root[BUFSIZ]; |
|
char errmsg[BUFSIZ]; |
|
|
|
if( !helpdir_is_initialized ) { |
|
get_rootdir(root,sizeof(root),errmsg); |
|
GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SISO639LANGNAME, lang, BUFSIZ); |
|
sprintf(helpdir, "%s\\help\\%s", root, lang); |
|
sprintf(file, "%s\\asirhelp.chm", helpdir); |
|
if ( access(file,0) < 0 ) { |
|
sprintf(helpdir, "%s\\help", root); |
|
} |
|
helpdir_is_initialized = 1; |
|
} |
|
return helpdir; |
} |
} |
|
|
BOOL Init_IO(char *errmsg) { |
BOOL Init_IO(char *errmsg) { |