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 | 119 | SOCKET_LIBS="-lws2_32" |
120 | 120 | CFLAGS="$CFLAGS -mms-bitfields" |
121 | 121 | localedir="locale" |
122 | - DLL_FLAGS="-shared" | |
122 | + DLL_FLAGS="-shared -Wl,--add-stdcall-alias" | |
123 | 123 | LDSOFLAGS="-Wl,-soname,\`basename \$@\`" |
124 | 124 | LDAPPFLAGS="-mwindows" |
125 | 125 | DBGRPATH="" | ... | ... |
po/pt_BR.po
... | ... | @@ -5,7 +5,7 @@ msgid "" |
5 | 5 | msgstr "" |
6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | 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 | 9 | "PO-Revision-Date: 2012-09-14 14:32-0300\n" |
10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | 11 | "Language-Team: Português <perry.werneck@gmail.com>\n" | ... | ... |
src/include/pw3270/hllapi.h
... | ... | @@ -58,7 +58,8 @@ extern "C" { |
58 | 58 | } HLLAPI_DATA; |
59 | 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 | 64 | #ifdef __cplusplus |
64 | 65 | } /* end of extern "C" */ | ... | ... |
src/plugins/remotectl/Makefile.in
... | ... | @@ -76,31 +76,31 @@ $(OBJRLS)/%.o: %.c $(DEPENDS) |
76 | 76 | |
77 | 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 | 82 | @echo " CCLD `basename $@`" |
83 | 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 | 87 | @echo " CCLD `basename $@`" |
88 | 88 | @$(MKDIR) `dirname $@` |
89 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | |
89 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) | |
90 | 90 | |
91 | 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 | 96 | @echo " CCLD `basename $@`" |
97 | 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 | 101 | @echo " CCLD `basename $@`" |
102 | 102 | @$(MKDIR) `dirname $@` |
103 | - @$(LD) $(DLL_FLAGS) -Wl,-soname,`basename $@` $(LDFLAGS) -o $@ $^ $(LIBS) | |
103 | + @$(LD) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) -o $@ $^ $(LIBS) | |
104 | 104 | |
105 | 105 | #---[ Misc targets ]----------------------------------------------------------- |
106 | 106 | ... | ... |
src/plugins/remotectl/hllapi.c
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | |
42 | 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 | 46 | int result = -1; |
47 | 47 | |
... | ... | @@ -70,10 +70,15 @@ |
70 | 70 | data->rc = *rc; |
71 | 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 | 83 | result = GetLastError(); |
79 | 84 | } |
... | ... | @@ -113,13 +118,38 @@ |
113 | 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 | 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 | 153 | break; |
124 | 154 | |
125 | 155 | default: |
... | ... | @@ -128,9 +158,10 @@ |
128 | 158 | if(set_session_name("pw3270A")) |
129 | 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 | 165 | return result; |
135 | 166 | } |
136 | 167 | ... | ... |
src/plugins/remotectl/remotectl.c
... | ... | @@ -133,6 +133,12 @@ |
133 | 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 | 142 | static int cmd_getrevision(unsigned short rc, char *string, unsigned short length) |
137 | 143 | { |
138 | 144 | strncpy(string,lib3270_get_revision(),length); |
... | ... | @@ -171,6 +177,7 @@ |
171 | 177 | int (*exec)(unsigned short rc, char *string, unsigned short length); |
172 | 178 | } cmd[] = |
173 | 179 | { |
180 | + { HLLAPI_CMD_CONNECTPS, cmd_connectps }, | |
174 | 181 | { HLLAPI_CMD_SETCURSOR, cmd_setcursor }, |
175 | 182 | { HLLAPI_CMD_INPUTSTRING, cmd_sendstring }, |
176 | 183 | { HLLAPI_CMD_GETREVISION, cmd_getrevision } | ... | ... |