Commit 05094bbee2bed33cb4aaecce5fc7076de98ebbc7
1 parent
261e0f3e
Exists in
master
and in
5 other branches
Corrigindo passagem de parametros HLLAPI
Showing
7 changed files
with
64 additions
and
22 deletions
Show diff stats
configure.ac
@@ -119,7 +119,7 @@ case "$host" in | @@ -119,7 +119,7 @@ case "$host" in | ||
119 | SOCKET_LIBS="-lws2_32" | 119 | SOCKET_LIBS="-lws2_32" |
120 | CFLAGS="$CFLAGS -mms-bitfields" | 120 | CFLAGS="$CFLAGS -mms-bitfields" |
121 | localedir="locale" | 121 | localedir="locale" |
122 | - DLL_FLAGS="-shared" | 122 | + DLL_FLAGS="-shared -Wl,--add-stdcall-alias" |
123 | LDSOFLAGS="-Wl,-soname,\`basename \$@\`" | 123 | LDSOFLAGS="-Wl,-soname,\`basename \$@\`" |
124 | LDAPPFLAGS="-mwindows" | 124 | LDAPPFLAGS="-mwindows" |
125 | DBGRPATH="" | 125 | DBGRPATH="" |
po/pt_BR.po
@@ -5,7 +5,7 @@ msgid "" | @@ -5,7 +5,7 @@ msgid "" | ||
5 | msgstr "" | 5 | msgstr "" |
6 | "Project-Id-Version: pw3270 5.0\n" | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | "Report-Msgid-Bugs-To: \n" | 7 | "Report-Msgid-Bugs-To: \n" |
8 | -"POT-Creation-Date: 2012-09-15 13:07-0300\n" | 8 | +"POT-Creation-Date: 2012-09-17 09:45-0300\n" |
9 | "PO-Revision-Date: 2012-09-14 14:32-0300\n" | 9 | "PO-Revision-Date: 2012-09-14 14:32-0300\n" |
10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | "Language-Team: Português <perry.werneck@gmail.com>\n" | 11 | "Language-Team: Português <perry.werneck@gmail.com>\n" |
src/include/pw3270/hllapi.h
@@ -58,7 +58,8 @@ extern "C" { | @@ -58,7 +58,8 @@ extern "C" { | ||
58 | } HLLAPI_DATA; | 58 | } HLLAPI_DATA; |
59 | #pragma pack() | 59 | #pragma pack() |
60 | 60 | ||
61 | - LIB3270_EXPORT int hllapi(unsigned long function, char *string, unsigned short length, unsigned short *rc); | 61 | + #warning Remover comentario |
62 | +// LIB3270_EXPORT int hllapi(unsigned long func, char *str, unsigned short length, unsigned short *rc); | ||
62 | 63 | ||
63 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
64 | } /* end of extern "C" */ | 65 | } /* end of extern "C" */ |
src/plugins/remotectl/Makefile.in
@@ -76,31 +76,31 @@ $(OBJRLS)/%.o: %.c $(DEPENDS) | @@ -76,31 +76,31 @@ $(OBJRLS)/%.o: %.c $(DEPENDS) | ||
76 | 76 | ||
77 | #---[ Release targets ]-------------------------------------------------------- | 77 | #---[ Release targets ]-------------------------------------------------------- |
78 | 78 | ||
79 | -Release: $(BINRLS)/plugins/$(MODULE_NAME).dll $(BINRLS)/libhllapi.dll | 79 | +Release: $(BINRLS)/plugins/$(MODULE_NAME)@DLLEXT@ $(BINRLS)/libhllapi@DLLEXT@ |
80 | 80 | ||
81 | -$(BINRLS)/plugins/$(MODULE_NAME).dll: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) | 81 | +$(BINRLS)/plugins/$(MODULE_NAME)@DLLEXT@: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) |
82 | @echo " CCLD `basename $@`" | 82 | @echo " CCLD `basename $@`" |
83 | @$(MKDIR) `dirname $@` | 83 | @$(MKDIR) `dirname $@` |
84 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(PW3270_LIBS) $(GTK_LIBS) | 84 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) $(PW3270_LIBS) $(GTK_LIBS) |
85 | 85 | ||
86 | -$(BINRLS)/libhllapi.dll: $(foreach SRC, $(basename $(HLLAPI_SRC)), $(OBJRLS)/$(SRC).o) | 86 | +$(BINRLS)/libhllapi@DLLEXT@: $(foreach SRC, $(basename $(HLLAPI_SRC)), $(OBJRLS)/$(SRC).o) |
87 | @echo " CCLD `basename $@`" | 87 | @echo " CCLD `basename $@`" |
88 | @$(MKDIR) `dirname $@` | 88 | @$(MKDIR) `dirname $@` |
89 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | 89 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) |
90 | 90 | ||
91 | #---[ Debug targets ]---------------------------------------------------------- | 91 | #---[ Debug targets ]---------------------------------------------------------- |
92 | 92 | ||
93 | -Debug: $(BINDBG)/plugins/$(MODULE_NAME).dll $(BINDBG)/libhllapi.dll | 93 | +Debug: $(BINDBG)/plugins/$(MODULE_NAME)@DLLEXT@ $(BINDBG)/libhllapi@DLLEXT@ |
94 | 94 | ||
95 | -$(BINDBG)/plugins/$(MODULE_NAME).dll: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) | 95 | +$(BINDBG)/plugins/$(MODULE_NAME)@DLLEXT@: $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) |
96 | @echo " CCLD `basename $@`" | 96 | @echo " CCLD `basename $@`" |
97 | @$(MKDIR) `dirname $@` | 97 | @$(MKDIR) `dirname $@` |
98 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) $(PW3270_LIBS) $(GTK_LIBS) | 98 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) $(PW3270_LIBS) $(GTK_LIBS) |
99 | 99 | ||
100 | -$(BINDBG)/libhllapi.dll: $(foreach SRC, $(basename $(HLLAPI_SRC)), $(OBJDBG)/$(SRC).o) | 100 | +$(BINDBG)/libhllapi@DLLEXT@: $(foreach SRC, $(basename $(HLLAPI_SRC)), $(OBJDBG)/$(SRC).o) |
101 | @echo " CCLD `basename $@`" | 101 | @echo " CCLD `basename $@`" |
102 | @$(MKDIR) `dirname $@` | 102 | @$(MKDIR) `dirname $@` |
103 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | 103 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) |
104 | 104 | ||
105 | #---[ Misc targets ]----------------------------------------------------------- | 105 | #---[ Misc targets ]----------------------------------------------------------- |
106 | 106 |
src/plugins/remotectl/hllapi.c
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | 41 | ||
42 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 42 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
43 | 43 | ||
44 | - static int run_query(unsigned long func, char *string, unsigned short length, unsigned short *rc) | 44 | + static int run_query(unsigned long func, const char *arg, char *string, unsigned short length, unsigned short *rc) |
45 | { | 45 | { |
46 | int result = -1; | 46 | int result = -1; |
47 | 47 | ||
@@ -70,10 +70,15 @@ | @@ -70,10 +70,15 @@ | ||
70 | data->rc = *rc; | 70 | data->rc = *rc; |
71 | data->len = length; | 71 | data->len = length; |
72 | 72 | ||
73 | - if(string && length > 0) | ||
74 | - memcpy(data->string,string,length); | 73 | + if(length > 0) |
74 | + { | ||
75 | + memset(data->string,0,length); | ||
76 | + if(arg) | ||
77 | + strncpy(data->string,arg,length); | ||
78 | + } | ||
75 | 79 | ||
76 | - memset(buffer,0,HLLAPI_MAXLENGTH); if(!CallNamedPipe(PipeName,(LPVOID)data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NMPWAIT_USE_DEFAULT_WAIT)) | 80 | + memset(buffer,0,HLLAPI_MAXLENGTH); |
81 | + if(!CallNamedPipe(PipeName,(LPVOID)data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NMPWAIT_USE_DEFAULT_WAIT)) | ||
77 | { | 82 | { |
78 | result = GetLastError(); | 83 | result = GetLastError(); |
79 | } | 84 | } |
@@ -113,13 +118,38 @@ | @@ -113,13 +118,38 @@ | ||
113 | return 0; | 118 | return 0; |
114 | } | 119 | } |
115 | 120 | ||
116 | - LIB3270_EXPORT int hllapi(unsigned long func, char *str, unsigned short length, unsigned short *rc) | 121 | + LIB3270_EXPORT int hllapi(unsigned long *func, char *str, unsigned short *length, unsigned short *rc) |
117 | { | 122 | { |
118 | - int result = 1; | ||
119 | - switch(func) | 123 | + int result = 1; |
124 | + char * arg; | ||
125 | + | ||
126 | + if(!length || *length > HLLAPI_MAXLENGTH) | ||
127 | + return EINVAL; | ||
128 | + | ||
129 | + if(length > 0) | ||
130 | + { | ||
131 | + arg = malloc(*length+1); | ||
132 | + strncpy(arg,str,(int) *length); | ||
133 | + arg[(size_t) *length] = 0; | ||
134 | + } | ||
135 | + else | ||
136 | + { | ||
137 | + arg = malloc(1); | ||
138 | + *arg = 0; | ||
139 | + } | ||
140 | + | ||
141 | +/* | ||
142 | +#ifdef DEBUG | ||
143 | + freopen("hllapi.log","a",stderr); | ||
144 | +#endif // DEBUG | ||
145 | +*/ | ||
146 | + | ||
147 | + switch(*func) | ||
120 | { | 148 | { |
121 | case HLLAPI_CMD_CONNECTPS: | 149 | case HLLAPI_CMD_CONNECTPS: |
122 | - result = set_session_name(str); | 150 | + result = set_session_name(arg); |
151 | + if(!result) | ||
152 | + result = run_query(*func, arg, str, *length, rc); | ||
123 | break; | 153 | break; |
124 | 154 | ||
125 | default: | 155 | default: |
@@ -128,9 +158,10 @@ | @@ -128,9 +158,10 @@ | ||
128 | if(set_session_name("pw3270A")) | 158 | if(set_session_name("pw3270A")) |
129 | return ENOENT; | 159 | return ENOENT; |
130 | } | 160 | } |
131 | - result = run_query(func, str, length, rc); | 161 | + result = run_query(*func, arg, str, *length, rc); |
132 | } | 162 | } |
133 | 163 | ||
164 | + free(arg); | ||
134 | return result; | 165 | return result; |
135 | } | 166 | } |
136 | 167 |
src/plugins/remotectl/remotectl.c
@@ -133,6 +133,12 @@ | @@ -133,6 +133,12 @@ | ||
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | 135 | ||
136 | + static int cmd_connectps(unsigned short rc, char *string, unsigned short length) | ||
137 | + { | ||
138 | + g_message("%s","HLLAPI ConnectPS request received"); | ||
139 | + return 0; | ||
140 | + } | ||
141 | + | ||
136 | static int cmd_getrevision(unsigned short rc, char *string, unsigned short length) | 142 | static int cmd_getrevision(unsigned short rc, char *string, unsigned short length) |
137 | { | 143 | { |
138 | strncpy(string,lib3270_get_revision(),length); | 144 | strncpy(string,lib3270_get_revision(),length); |
@@ -171,6 +177,7 @@ | @@ -171,6 +177,7 @@ | ||
171 | int (*exec)(unsigned short rc, char *string, unsigned short length); | 177 | int (*exec)(unsigned short rc, char *string, unsigned short length); |
172 | } cmd[] = | 178 | } cmd[] = |
173 | { | 179 | { |
180 | + { HLLAPI_CMD_CONNECTPS, cmd_connectps }, | ||
174 | { HLLAPI_CMD_SETCURSOR, cmd_setcursor }, | 181 | { HLLAPI_CMD_SETCURSOR, cmd_setcursor }, |
175 | { HLLAPI_CMD_INPUTSTRING, cmd_sendstring }, | 182 | { HLLAPI_CMD_INPUTSTRING, cmd_sendstring }, |
176 | { HLLAPI_CMD_GETREVISION, cmd_getrevision } | 183 | { HLLAPI_CMD_GETREVISION, cmd_getrevision } |
src/pw3270/plugin.c
@@ -46,6 +46,9 @@ | @@ -46,6 +46,9 @@ | ||
46 | GError * err = NULL; | 46 | GError * err = NULL; |
47 | GList * lst = NULL; | 47 | GList * lst = NULL; |
48 | 48 | ||
49 | + if(!g_file_test(path,G_FILE_TEST_IS_DIR)) | ||
50 | + return; | ||
51 | + | ||
49 | trace("Loading plugins from %s",path); | 52 | trace("Loading plugins from %s",path); |
50 | 53 | ||
51 | dir = g_dir_open(path,0,&err); | 54 | dir = g_dir_open(path,0,&err); |