version 1.1, 2000/11/22 06:14:29 |
version 1.5, 2009/08/25 08:01:03 |
|
|
#include <fcntl.h> |
#include <fcntl.h> |
#include <process.h> |
#include <process.h> |
|
|
|
#include "asir32gui_io.h" |
|
|
#define ECGEN_KEYNAME "SoftWare\\Fujitsu\\FSEcParamGen\\V1.0L10" |
#define ECGEN_KEYNAME "SoftWare\\Fujitsu\\FSEcParamGen\\V1.0L10" |
#define ASIR_KEYNAME "SoftWare\\Fujitsu\\Asir\\1999.03.31" |
#define ASIR_KEYNAME "SoftWare\\Fujitsu\\Asir\\1999.03.31" |
|
|
|
|
|
|
static int use_current_dir; |
static int use_current_dir; |
|
|
int asir_main_window; |
int asirgui_kind; |
HANDLE hProc; |
HANDLE hProc; |
static HANDLE hRead,hWrite; |
static HANDLE hRead,hWrite; |
HANDLE hNotify,hNotify_Ack; |
HANDLE hNotify,hNotify_Ack; |
|
|
return TRUE; |
return TRUE; |
} |
} |
|
|
|
GetCurrentDirectory(BUFSIZ,dir); |
|
slash = strrchr(dir,'\\'); |
|
if ( slash ) |
|
*slash = 0; |
|
ldir = strlen(dir)+1; |
|
if ( access("UseCurrentDir",0) >= 0 ) { |
|
use_current_dir = 1; |
|
strcpy(rootdir,dir); |
|
strcpy(name,dir); |
|
rootdir_is_initialized = 1; |
|
return TRUE; |
|
} |
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ECGEN_KEYNAME, 0, |
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ECGEN_KEYNAME, 0, |
KEY_QUERY_VALUE, &hOpenKey); |
KEY_QUERY_VALUE, &hOpenKey); |
if ( ret != ERROR_SUCCESS ) |
if ( ret != ERROR_SUCCESS ) |
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ASIR_KEYNAME, 0, |
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ASIR_KEYNAME, 0, |
KEY_QUERY_VALUE, &hOpenKey); |
KEY_QUERY_VALUE, &hOpenKey); |
if( ret != ERROR_SUCCESS ) { |
if( ret != ERROR_SUCCESS ) { |
GetCurrentDirectory(BUFSIZ,dir); |
|
slash = strrchr(dir,'\\'); |
|
if ( slash ) |
|
*slash = 0; |
|
ldir = strlen(dir)+1; |
|
if ( access("UseCurrentDir",0) >= 0 ) { |
|
use_current_dir = 1; |
|
strcpy(rootdir,dir); |
|
strcpy(name,dir); |
|
rootdir_is_initialized = 1; |
|
return TRUE; |
|
} |
|
|
|
sprintf(message,"May I register '%s' as the ASIR main directory?",dir); |
sprintf(message,"May I register '%s' as the ASIR main directory?",dir); |
if( IDNO == MessageBox(NULL,message,"Asir", |
if( IDNO == MessageBox(NULL,message,"Asir", |
MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2) ) { |
MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2) ) { |
Line 118 BOOL Init_IO(char *errmsg) { |
|
Line 119 BOOL Init_IO(char *errmsg) { |
|
|
|
_setargv(); |
_setargv(); |
if ( !strcmp(__argv[0],"debuggui") ) { |
if ( !strcmp(__argv[0],"debuggui") ) { |
asir_main_window = 0; |
asirgui_kind = ASIRGUI_DEBUG; |
hRead = atoi(__argv[1]); |
hRead = atoi(__argv[1]); |
hWrite = atoi(__argv[2]); |
hWrite = atoi(__argv[2]); |
hNotify = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[3]); |
hNotify = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[3]); |
Line 128 BOOL Init_IO(char *errmsg) { |
|
Line 129 BOOL Init_IO(char *errmsg) { |
|
hKill = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[7]); |
hKill = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[7]); |
return TRUE; |
return TRUE; |
} else if ( !strcmp(__argv[0],"messagegui") ) { |
} else if ( !strcmp(__argv[0],"messagegui") ) { |
asir_main_window = 0; |
asirgui_kind = ASIRGUI_MESSAGE; |
hRead = atoi(__argv[1]); |
hRead = atoi(__argv[1]); |
hWrite = atoi(__argv[2]); |
hWrite = atoi(__argv[2]); |
hNotify = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[3]); |
hNotify = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[3]); |
hNotify_Ack = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[4]); |
hNotify_Ack = OpenEvent(EVENT_ALL_ACCESS|EVENT_MODIFY_STATE,TRUE,__argv[4]); |
return TRUE; |
return TRUE; |
} else { |
} else { |
asir_main_window = 1; |
asirgui_kind = ASIRGUI_MAIN; |
mypid = GetCurrentProcessId(); |
mypid = GetCurrentProcessId(); |
sprintf(notify,"asir_notify_%d",mypid); |
sprintf(notify,"asir_notify_%d",mypid); |
sprintf(notify_ack,"asir_notify_ack_%d",mypid); |
sprintf(notify_ack,"asir_notify_ack_%d",mypid); |
Line 258 void read_and_insert() |
|
Line 259 void read_and_insert() |
|
} |
} |
} |
} |
|
|
|
static char history_path[BUFSIZ]; |
|
static char history_errmsg[BUFSIZ]; |
|
|
void init_input_history() |
void init_input_history() |
{ |
{ |
|
char rootdir[BUFSIZ]; |
|
get_rootdir(rootdir,sizeof(rootdir),history_errmsg); |
|
sprintf(history_path,"%s\\bin\\%s",rootdir,HISTORY); |
init_hist(MAXHIST); |
init_hist(MAXHIST); |
} |
} |
|
|
void write_input_history() |
void write_input_history() |
{ |
{ |
write_hist(HISTORY); |
write_hist(history_path); |
} |
} |
|
|
void read_input_history() |
void read_input_history() |
{ |
{ |
read_hist(HISTORY); |
read_hist(history_path); |
} |
} |
|
|
void send_intr() { |
void send_intr() { |