Commit 5e674a1fdee5cdd215bfb3f89f7b35b622dc8352
1 parent
38a6d1d8
Exists in
master
and in
1 other branch
Updating packages.
Showing
10 changed files
with
336 additions
and
74 deletions
Show diff stats
Makefile.in
@@ -112,7 +112,7 @@ $(OBJDBG)/%.o: \ | @@ -112,7 +112,7 @@ $(OBJDBG)/%.o: \ | ||
112 | 112 | ||
113 | @$(CXX) \ | 113 | @$(CXX) \ |
114 | $(CFLAGS) \ | 114 | $(CFLAGS) \ |
115 | - -Wall -Wextra -fstack-check \ | 115 | + -g -Wall -Wextra -fstack-check \ |
116 | -DDEBUG=1 \ | 116 | -DDEBUG=1 \ |
117 | -o $@ \ | 117 | -o $@ \ |
118 | -c $< | 118 | -c $< |
@@ -159,7 +159,7 @@ $(BINRLS)/$(SONAME): \ | @@ -159,7 +159,7 @@ $(BINRLS)/$(SONAME): \ | ||
159 | @$(MKDIR) $(dir $@) | 159 | @$(MKDIR) $(dir $@) |
160 | @echo $< ... | 160 | @echo $< ... |
161 | @$(LD) \ | 161 | @$(LD) \ |
162 | - @DLL_LDFLAGS@ \ | 162 | + -shared -Wl,-soname,$(@F) \ |
163 | -o $@ \ | 163 | -o $@ \ |
164 | $(LDFLAGS) \ | 164 | $(LDFLAGS) \ |
165 | $^ \ | 165 | $^ \ |
configure.ac
@@ -57,18 +57,6 @@ AC_PROG_LN_S | @@ -57,18 +57,6 @@ AC_PROG_LN_S | ||
57 | AC_LANG([C++]) | 57 | AC_LANG([C++]) |
58 | 58 | ||
59 | dnl --------------------------------------------------------------------------- | 59 | dnl --------------------------------------------------------------------------- |
60 | -dnl Initialize defaults | ||
61 | -dnl --------------------------------------------------------------------------- | ||
62 | - | ||
63 | -DBG_CFLAGS="-g -fstack-check -DDEBUG=1" | ||
64 | -RLS_CFLAGS="-DNDEBUG=1" | ||
65 | -PLUGINS="" | ||
66 | -APP_RESOURCES="" | ||
67 | -APP_LDFLAGS="" | ||
68 | -DLL_LDFLAGS="-shared -Wl,-soname,\$(@F)" | ||
69 | -DEPENDS="" | ||
70 | - | ||
71 | -dnl --------------------------------------------------------------------------- | ||
72 | dnl Version info | 60 | dnl Version info |
73 | dnl --------------------------------------------------------------------------- | 61 | dnl --------------------------------------------------------------------------- |
74 | 62 | ||
@@ -109,7 +97,9 @@ case "$host" in | @@ -109,7 +97,9 @@ case "$host" in | ||
109 | *-mingw32|*-pc-msys) | 97 | *-mingw32|*-pc-msys) |
110 | app_cv_osname="windows" | 98 | app_cv_osname="windows" |
111 | 99 | ||
112 | - CFLAGS="$CFLAGS -pthread -D_WIN32_WINNT=0x0600" | 100 | + CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0600" |
101 | + LDFLAGS="-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic -static-libgcc -static-libstdc++ $LDFLAGS" | ||
102 | + | ||
113 | LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32" | 103 | LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32" |
114 | DLLEXT=".dll" | 104 | DLLEXT=".dll" |
115 | 105 | ||
@@ -137,8 +127,8 @@ case "$host" in | @@ -137,8 +127,8 @@ case "$host" in | ||
137 | ;; | 127 | ;; |
138 | 128 | ||
139 | *) | 129 | *) |
140 | - CFLAGS="$CFLAGS -pthread" | ||
141 | - LDFLAGS="$LDFLAGS -pthread" | 130 | + CFLAGS="$CFLAGS" |
131 | + LDFLAGS="$LDFLAGS" | ||
142 | app_cv_datadir="/usr/share" | 132 | app_cv_datadir="/usr/share" |
143 | app_cv_confdir="/etc" | 133 | app_cv_confdir="/etc" |
144 | app_cv_osname="linux" | 134 | app_cv_osname="linux" |
@@ -155,8 +145,6 @@ AC_SUBST(LIBS) | @@ -155,8 +145,6 @@ AC_SUBST(LIBS) | ||
155 | AC_SUBST(LOGDIR) | 145 | AC_SUBST(LOGDIR) |
156 | AC_SUBST(DLLEXT) | 146 | AC_SUBST(DLLEXT) |
157 | AC_SUBST(DLLPREFIX) | 147 | AC_SUBST(DLLPREFIX) |
158 | -AC_SUBST(LDFLAGS) | ||
159 | -AC_SUBST(DLL_LDFLAGS) | ||
160 | 148 | ||
161 | dnl --------------------------------------------------------------------------- | 149 | dnl --------------------------------------------------------------------------- |
162 | dnl Check for other programs | 150 | dnl Check for other programs |
@@ -261,10 +249,9 @@ if test "$app_cv_static_ipc3270" == "auto"; then | @@ -261,10 +249,9 @@ if test "$app_cv_static_ipc3270" == "auto"; then | ||
261 | fi | 249 | fi |
262 | 250 | ||
263 | if test "$app_cv_static_ipc3270" == "yes"; then | 251 | if test "$app_cv_static_ipc3270" == "yes"; then |
264 | - LDFLAGS="-static -static-libgcc -static-libstdc++ $LDFLAGS" | ||
265 | PKG_CHECK_MODULES( [IPC3270], [ipc3270-static], AC_DEFINE(USING_STATIC_IPC3270), AC_MSG_ERROR([IPC3270 not present.])) | 252 | PKG_CHECK_MODULES( [IPC3270], [ipc3270-static], AC_DEFINE(USING_STATIC_IPC3270), AC_MSG_ERROR([IPC3270 not present.])) |
266 | else | 253 | else |
267 | - PKG_CHECK_MODULES( [IPC3270], [ipc3270], AC_DEFINE(USING_SHARED_IPC3270), AC_MSG_ERROR([IPC3270 not present.])) | 254 | + PKG_CHECK_MODULES( [IPC3270], [ipc3270], AC_DEFINE(USING_DYNAMIC_IPC3270), AC_MSG_ERROR([IPC3270 not present.])) |
268 | fi | 255 | fi |
269 | 256 | ||
270 | AC_SUBST(IPC3270_LIBS) | 257 | AC_SUBST(IPC3270_LIBS) |
@@ -309,12 +296,14 @@ dnl --------------------------------------------------------------------------- | @@ -309,12 +296,14 @@ dnl --------------------------------------------------------------------------- | ||
309 | dnl Configure which files to generate. | 296 | dnl Configure which files to generate. |
310 | dnl --------------------------------------------------------------------------- | 297 | dnl --------------------------------------------------------------------------- |
311 | 298 | ||
312 | -AC_SUBST(DEPENDS) | ||
313 | AC_CONFIG_FILES(Makefile) | 299 | AC_CONFIG_FILES(Makefile) |
314 | 300 | ||
315 | dnl --------------------------------------------------------------------------- | 301 | dnl --------------------------------------------------------------------------- |
316 | dnl Output the generated config.status script. | 302 | dnl Output the generated config.status script. |
317 | dnl --------------------------------------------------------------------------- | 303 | dnl --------------------------------------------------------------------------- |
304 | + | ||
305 | +AC_SUBST(LDFLAGS) | ||
306 | + | ||
318 | AC_SUBST(BASEDIR,$ac_pwd) | 307 | AC_SUBST(BASEDIR,$ac_pwd) |
319 | 308 | ||
320 | AC_OUTPUT | 309 | AC_OUTPUT |
hllapi.cbp
@@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
42 | <Unit filename="src/core/private.h" /> | 42 | <Unit filename="src/core/private.h" /> |
43 | <Unit filename="src/core/set.cc" /> | 43 | <Unit filename="src/core/set.cc" /> |
44 | <Unit filename="src/core/tools.cc" /> | 44 | <Unit filename="src/core/tools.cc" /> |
45 | + <Unit filename="src/core/windows/init.cc" /> | ||
45 | <Unit filename="src/core/windows/resources.rc" /> | 46 | <Unit filename="src/core/windows/resources.rc" /> |
46 | <Unit filename="src/include/config.h" /> | 47 | <Unit filename="src/include/config.h" /> |
47 | <Unit filename="src/include/lib3270/hllapi.h" /> | 48 | <Unit filename="src/include/lib3270/hllapi.h" /> |
rpm/libhllapi.spec
1 | # | 1 | # |
2 | -# spec file for packages pw3270-plugin-ipc | 2 | +# spec file for package libhllapi |
3 | # | 3 | # |
4 | # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. | 4 | # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. |
5 | # Copyright (C) <2008> <Banco do Brasil S.A.> | 5 | # Copyright (C) <2008> <Banco do Brasil S.A.> |
@@ -16,15 +16,10 @@ | @@ -16,15 +16,10 @@ | ||
16 | # Please submit bugfixes or comments via http://bugs.opensuse.org/ | 16 | # Please submit bugfixes or comments via http://bugs.opensuse.org/ |
17 | # | 17 | # |
18 | 18 | ||
19 | -#---[ Versions ]------------------------------------------------------------------------------------------------------ | ||
20 | - | ||
21 | -%define MAJOR_VERSION 5 | ||
22 | -%define MINOR_VERSION 2 | ||
23 | - | ||
24 | -#---[ Main package ]-------------------------------------------------------------------------------------------------- | 19 | +#---[ Package header ]------------------------------------------------------------------------------------------------ |
25 | 20 | ||
26 | Summary: HLLAPI client library for lib3270/pw3270 | 21 | Summary: HLLAPI client library for lib3270/pw3270 |
27 | -Name: libhllapi5_2 | 22 | +Name: libhllapi |
28 | Version: 5.2 | 23 | Version: 5.2 |
29 | Release: 0 | 24 | Release: 0 |
30 | License: LGPL-3.0 | 25 | License: LGPL-3.0 |
@@ -32,8 +27,7 @@ Source: lib3270-hllapi-bindings-%{version}.tar.xz | @@ -32,8 +27,7 @@ Source: lib3270-hllapi-bindings-%{version}.tar.xz | ||
32 | 27 | ||
33 | Url: https://github.com/PerryWerneck/lib3270-hllapi-bindings.git | 28 | Url: https://github.com/PerryWerneck/lib3270-hllapi-bindings.git |
34 | 29 | ||
35 | -Group: System/X11/Terminals | ||
36 | -BuildRoot: /var/tmp/%{name}-%{version} | 30 | +Group: Development/Libraries/C and C++ |
37 | 31 | ||
38 | BuildRequires: autoconf >= 2.61 | 32 | BuildRequires: autoconf >= 2.61 |
39 | BuildRequires: automake | 33 | BuildRequires: automake |
@@ -63,6 +57,24 @@ HLLAPI client library for pw3270/lib3270 | @@ -63,6 +57,24 @@ HLLAPI client library for pw3270/lib3270 | ||
63 | 57 | ||
64 | See more details at https://softwarepublico.gov.br/social/pw3270/ | 58 | See more details at https://softwarepublico.gov.br/social/pw3270/ |
65 | 59 | ||
60 | +#---[ Library ]------------------------------------------------------------------------------------------------------- | ||
61 | + | ||
62 | +%define MAJOR_VERSION %(echo %{version} | cut -d. -f1) | ||
63 | +%define MINOR_VERSION %(echo %{version} | cut -d. -f2) | ||
64 | +%define _libvrs %{MAJOR_VERSION}_%{MINOR_VERSION} | ||
65 | + | ||
66 | +%package -n %{name}%{_libvrs} | ||
67 | +Summary: HLLAPI client library for lib3270/pw3270 | ||
68 | +Group: Development/Libraries/C and C++ | ||
69 | + | ||
70 | +%description -n %{name}%{_libvrs} | ||
71 | + | ||
72 | +HLLAPI client library for pw3270/lib3270 | ||
73 | + | ||
74 | +See more details at https://softwarepublico.gov.br/social/pw3270/ | ||
75 | + | ||
76 | +#---[ Development package ]------------------------------------------------------------------------------------------- | ||
77 | + | ||
66 | %package devel | 78 | %package devel |
67 | Summary: HLLAPI Development files. | 79 | Summary: HLLAPI Development files. |
68 | 80 | ||
@@ -76,7 +88,8 @@ Development files for lib3270/pw3270 HLLAPI client library. | @@ -76,7 +88,8 @@ Development files for lib3270/pw3270 HLLAPI client library. | ||
76 | %prep | 88 | %prep |
77 | %setup -n lib3270-hllapi-bindings-%{version} | 89 | %setup -n lib3270-hllapi-bindings-%{version} |
78 | 90 | ||
79 | -NOCONFIGURE=1 ./autogen.sh | 91 | +NOCONFIGURE=1 \ |
92 | + ./autogen.sh | ||
80 | 93 | ||
81 | %configure | 94 | %configure |
82 | 95 | ||
@@ -87,33 +100,33 @@ make all | @@ -87,33 +100,33 @@ make all | ||
87 | %install | 100 | %install |
88 | rm -rf $RPM_BUILD_ROOT | 101 | rm -rf $RPM_BUILD_ROOT |
89 | 102 | ||
90 | -make \ | ||
91 | - DESTDIR=%{?buildroot:%{buildroot}} \ | ||
92 | - install | 103 | +%makeinstall |
93 | 104 | ||
94 | -%files | 105 | +%files -n %{name}%{_libvrs} |
95 | %defattr(-,root,root) | 106 | %defattr(-,root,root) |
96 | -%doc AUTHORS LICENSE README.md | ||
97 | 107 | ||
98 | -%{_libdir}/libhllapi.so.%{MAJOR_VERSION} | ||
99 | -%{_libdir}/libhllapi.so.%{MAJOR_VERSION}.%{MINOR_VERSION} | 108 | +# https://en.opensuse.org/openSUSE:Packaging_for_Leap#RPM_Distro_Version_Macros |
109 | +%if 0%{?sle_version} > 120200 | ||
110 | +%doc AUTHORS README.md | ||
111 | +%license LICENSE | ||
112 | +%else | ||
113 | +%doc AUTHORS README.md LICENSE | ||
114 | +%endif | ||
115 | + | ||
116 | +%{_libdir}/%{name}.so.%{MAJOR_VERSION} | ||
117 | +%{_libdir}/%{name}.so.%{MAJOR_VERSION}.%{MINOR_VERSION} | ||
100 | 118 | ||
101 | %files devel | 119 | %files devel |
102 | %defattr(-,root,root) | 120 | %defattr(-,root,root) |
103 | -%{_libdir}/libhllapi.so | 121 | + |
122 | +%{_libdir}/%{name}.so | ||
104 | %{_includedir}/lib3270/hllapi.h | 123 | %{_includedir}/lib3270/hllapi.h |
105 | 124 | ||
106 | -%pre | ||
107 | -/sbin/ldconfig | ||
108 | -exit 0 | 125 | +%pre -n %{name}%{_libvrs} -p /sbin/ldconfig |
109 | 126 | ||
110 | -%post | ||
111 | -/sbin/ldconfig | ||
112 | -exit 0 | 127 | +%post -n %{name}%{_libvrs} -p /sbin/ldconfig |
113 | 128 | ||
114 | -%postun | ||
115 | -/sbin/ldconfig | ||
116 | -exit 0 | 129 | +%postun -n %{name}%{_libvrs} -p /sbin/ldconfig |
117 | 130 | ||
118 | %changelog | 131 | %changelog |
119 | 132 |
src/core/tools.cc
@@ -34,6 +34,54 @@ | @@ -34,6 +34,54 @@ | ||
34 | 34 | ||
35 | HLLAPI_API_CALL hllapi_get_datadir(LPSTR datadir) { | 35 | HLLAPI_API_CALL hllapi_get_datadir(LPSTR datadir) { |
36 | 36 | ||
37 | + LSTATUS rc; | ||
38 | + HKEY hKey = 0; | ||
39 | + unsigned long szDatadir = strlen(datadir); | ||
40 | + | ||
41 | + static const char * keys[] = { | ||
42 | + | ||
43 | + "Software\\" LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME), | ||
44 | + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME), | ||
45 | + | ||
46 | +#ifdef LIB3270_NAME | ||
47 | + "Software\\" LIB3270_STRINGIZE_VALUE_OF(LIB3270_NAME), | ||
48 | + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" LIB3270_STRINGIZE_VALUE_OF(LIB3270_NAME), | ||
49 | +#endif | ||
50 | + | ||
51 | + "Software\\pw3270", | ||
52 | + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\pw3270" | ||
53 | + }; | ||
54 | + | ||
55 | + size_t ix; | ||
56 | + | ||
57 | + string installLocation; | ||
58 | + | ||
59 | + *datadir = 0; | ||
60 | + | ||
61 | + for(ix = 0; !*datadir && ix < (sizeof(keys)/sizeof(keys[0])); ix++) { | ||
62 | + | ||
63 | + rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,keys[ix],0,KEY_QUERY_VALUE,&hKey); | ||
64 | + if(rc == ERROR_SUCCESS) { | ||
65 | + | ||
66 | + unsigned long datatype; // #defined in winnt.h (predefined types 0-11) | ||
67 | + unsigned long datalen = (unsigned long) szDatadir; | ||
68 | + | ||
69 | + memset(datadir,0,datalen); | ||
70 | + | ||
71 | + rc = RegQueryValueExA(hKey,"InstallLocation",NULL,&datatype,(LPBYTE) datadir,&datalen); | ||
72 | + if(rc != ERROR_SUCCESS) { | ||
73 | + *datadir = 0; // Just in case | ||
74 | + } | ||
75 | + | ||
76 | + RegCloseKey(hKey); | ||
77 | + | ||
78 | + } | ||
79 | + | ||
80 | + } | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + /* | ||
37 | #ifdef _WIN32 | 85 | #ifdef _WIN32 |
38 | HKEY hKey = 0; | 86 | HKEY hKey = 0; |
39 | unsigned long datalen = strlen(datadir); | 87 | unsigned long datalen = strlen(datadir); |
@@ -48,6 +96,7 @@ | @@ -48,6 +96,7 @@ | ||
48 | RegCloseKey(hKey); | 96 | RegCloseKey(hKey); |
49 | } | 97 | } |
50 | #endif // _WIN32 | 98 | #endif // _WIN32 |
99 | +*/ | ||
51 | 100 | ||
52 | return *datadir; | 101 | return *datadir; |
53 | } | 102 | } |
@@ -0,0 +1,200 @@ | @@ -0,0 +1,200 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | +/** | ||
31 | + * @file | ||
32 | + * | ||
33 | + * @brief Win32 delayed loading support methods. | ||
34 | + * | ||
35 | + * @author perry.werneck@gmail.com | ||
36 | + * | ||
37 | + */ | ||
38 | + | ||
39 | + #include <config.h> | ||
40 | + #include <winsock2.h> | ||
41 | + #include <windows.h> | ||
42 | + #include "../private.h" | ||
43 | + #include <lmcons.h> | ||
44 | + #include <delayimp.h> | ||
45 | + #include <fcntl.h> | ||
46 | + #include <string> | ||
47 | + #include <stdexcept> | ||
48 | + #include <lib3270.h> | ||
49 | + | ||
50 | + #ifdef USING_STATIC_IPC3270 | ||
51 | + | ||
52 | + extern "C" { | ||
53 | + | ||
54 | + extern __declspec (dllexport) PfnDliHook __pfnDliNotifyHook2; | ||
55 | + extern __declspec (dllexport) PfnDliHook __pfnDliFailureHook2; | ||
56 | + | ||
57 | + FARPROC WINAPI hllapi_delay_load_hook(unsigned reason, DelayLoadInfo * info); | ||
58 | + | ||
59 | + } | ||
60 | + | ||
61 | + using std::string; | ||
62 | + | ||
63 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
64 | + | ||
65 | + // https://docs.microsoft.com/en-us/cpp/build/reference/loading-all-imports-for-a-delay-loaded-dll?view=vs-2019 | ||
66 | + | ||
67 | + PfnDliHook __pfnDliNotifyHook2 = hllapi_delay_load_hook; | ||
68 | + PfnDliHook __pfnDliFailureHook2 = hllapi_delay_load_hook; | ||
69 | + | ||
70 | + static HANDLE hModule = 0; | ||
71 | + static HANDLE hEventLog = 0; | ||
72 | + | ||
73 | + BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwcallpurpose, LPVOID lpvResvd) { | ||
74 | + switch(dwcallpurpose) { | ||
75 | + case DLL_PROCESS_ATTACH: | ||
76 | + hModule = hInstance; | ||
77 | + hEventLog = RegisterEventSource(NULL, LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)); | ||
78 | + break; | ||
79 | + | ||
80 | + case DLL_PROCESS_DETACH: | ||
81 | + hModule = 0; | ||
82 | + DeregisterEventSource(hEventLog); | ||
83 | + hEventLog = 0; | ||
84 | + break; | ||
85 | + | ||
86 | + } | ||
87 | + | ||
88 | + return TRUE; | ||
89 | + } | ||
90 | + | ||
91 | + static void eventlog(const char *msg) { | ||
92 | + | ||
93 | + char username[UNLEN + 1]; | ||
94 | + DWORD szName = sizeof(username); | ||
95 | + | ||
96 | + memset(username,0,UNLEN + 1); | ||
97 | + | ||
98 | + if(!GetUserName(username, &szName)) { | ||
99 | + username[0] = 0; | ||
100 | + } | ||
101 | + | ||
102 | + const char *outMsg[] = { | ||
103 | + username, | ||
104 | + PACKAGE_NAME, | ||
105 | + msg | ||
106 | + }; | ||
107 | + | ||
108 | + debug("Event: \"%s\"",msg); | ||
109 | + | ||
110 | + ReportEvent( | ||
111 | + hEventLog, | ||
112 | + EVENTLOG_ERROR_TYPE, | ||
113 | + 1, | ||
114 | + 0, | ||
115 | + NULL, | ||
116 | + 3, | ||
117 | + 0, | ||
118 | + outMsg, | ||
119 | + NULL | ||
120 | + ); | ||
121 | + | ||
122 | + } | ||
123 | + | ||
124 | + static void dummyProc() { | ||
125 | + throw std::runtime_error("Operation not supported"); | ||
126 | + } | ||
127 | + | ||
128 | + FARPROC WINAPI hllapi_delay_load_hook(unsigned reason, DelayLoadInfo * info) { | ||
129 | + | ||
130 | + static string savedpath; | ||
131 | + | ||
132 | + // https://docs.microsoft.com/en-us/cpp/build/reference/structure-and-constant-definitions?view=vs-2019 | ||
133 | + switch (reason) { | ||
134 | + case dliNoteStartProcessing: | ||
135 | + { | ||
136 | + | ||
137 | + char datadir[4096]; | ||
138 | + memset(datadir,' ',sizeof(datadir)); | ||
139 | + datadir[sizeof(datadir)-1] = 0; | ||
140 | + | ||
141 | + hllapi_get_datadir(datadir); | ||
142 | + | ||
143 | + if(*datadir) { | ||
144 | + | ||
145 | + char curdir[4096]; | ||
146 | + memset(curdir,0,sizeof(curdir)); | ||
147 | + | ||
148 | + if(GetCurrentDirectory(sizeof(curdir)-1,curdir)) { | ||
149 | + savedpath = curdir; | ||
150 | + } else { | ||
151 | + savedpath.clear(); | ||
152 | + } | ||
153 | + | ||
154 | + SetCurrentDirectory(curdir); | ||
155 | + | ||
156 | + } | ||
157 | + | ||
158 | + } | ||
159 | + break; | ||
160 | + | ||
161 | + case dliNoteEndProcessing: | ||
162 | + if(!savedpath.empty()) { | ||
163 | + SetCurrentDirectory(savedpath.c_str()); | ||
164 | + savedpath.clear(); | ||
165 | + | ||
166 | + } | ||
167 | + break; | ||
168 | + | ||
169 | + case dliNotePreLoadLibrary: | ||
170 | + break; | ||
171 | + | ||
172 | + case dliNotePreGetProcAddress: | ||
173 | + break; | ||
174 | + | ||
175 | + case dliFailLoadLib: | ||
176 | + { | ||
177 | + string msg = "Can't load "; | ||
178 | + msg += (const char *) info->szDll; | ||
179 | + eventlog(msg.c_str()); | ||
180 | + } | ||
181 | + return (FARPROC) hModule; | ||
182 | + | ||
183 | + case dliFailGetProc: | ||
184 | + { | ||
185 | + string msg = "Can't find method on "; | ||
186 | + msg += (const char *) info->szDll; | ||
187 | + eventlog(msg.c_str()); | ||
188 | + } | ||
189 | + return (FARPROC) dummyProc; | ||
190 | + | ||
191 | + } | ||
192 | + | ||
193 | + // Returning NULL causes the delay load machinery to perform default | ||
194 | + // processing for this notification. | ||
195 | + return NULL; | ||
196 | + | ||
197 | + } | ||
198 | + | ||
199 | + #endif // USING_STATIC_IPC3270 | ||
200 | + |
src/include/config.h.in
src/testprogram/testprogram.cc
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | char buffer[SCREEN_LENGTH+1]; | 44 | char buffer[SCREEN_LENGTH+1]; |
45 | 45 | ||
46 | const char *host = ""; | 46 | const char *host = ""; |
47 | - const char *session = "pw3270:a"; | 47 | + const char *session = ""; // "pw3270:a"; |
48 | 48 | ||
49 | #pragma GCC diagnostic push | 49 | #pragma GCC diagnostic push |
50 | static struct option options[] = | 50 | static struct option options[] = |
win/hllapi.nsi
@@ -4,11 +4,11 @@ | @@ -4,11 +4,11 @@ | ||
4 | 4 | ||
5 | Name "hllapi" | 5 | Name "hllapi" |
6 | Caption "hllapi - PW3270 HLLAPI Module" | 6 | Caption "hllapi - PW3270 HLLAPI Module" |
7 | -outfile "hllapi-5.2.19.9-i686.exe" | 7 | +outfile "hllapi-5.2.19.9-x86_64.exe" |
8 | 8 | ||
9 | XPStyle on | 9 | XPStyle on |
10 | 10 | ||
11 | -installDir "$PROGRAMFILES\hllapi" | 11 | +installDir "$PROGRAMFILES64\hllapi" |
12 | 12 | ||
13 | # Get installation folder from registry if available | 13 | # Get installation folder from registry if available |
14 | InstallDirRegKey HKLM "Software\hllapi" "InstallLocation" | 14 | InstallDirRegKey HKLM "Software\hllapi" "InstallLocation" |
@@ -17,10 +17,10 @@ RequestExecutionLevel admin | @@ -17,10 +17,10 @@ RequestExecutionLevel admin | ||
17 | 17 | ||
18 | # Properties | 18 | # Properties |
19 | VIProductVersion "5.2.19.9" | 19 | VIProductVersion "5.2.19.9" |
20 | -VIFileVersion "19.9.2.11" | 20 | +VIFileVersion "19.9.23.14" |
21 | 21 | ||
22 | VIAddVersionKey "ProductVersion" "5.2.19.9" | 22 | VIAddVersionKey "ProductVersion" "5.2.19.9" |
23 | -VIAddVersionKey "FileVersion" "19.9.2.11" | 23 | +VIAddVersionKey "FileVersion" "19.9.23.14" |
24 | 24 | ||
25 | VIAddVersionKey "ProductName" "hllapi" | 25 | VIAddVersionKey "ProductName" "hllapi" |
26 | VIAddVersionKey "FileDescription" "PW3270 HLLAPI Module" | 26 | VIAddVersionKey "FileDescription" "PW3270 HLLAPI Module" |
@@ -51,7 +51,7 @@ SubSection "hllapi" SecMain | @@ -51,7 +51,7 @@ SubSection "hllapi" SecMain | ||
51 | 51 | ||
52 | Section "Core" SecCore | 52 | Section "Core" SecCore |
53 | 53 | ||
54 | - SetRegView 32 | 54 | + SetRegView 64 |
55 | ${DisableX64FSRedirection} | 55 | ${DisableX64FSRedirection} |
56 | 56 | ||
57 | # define the output path for this file | 57 | # define the output path for this file |
@@ -107,7 +107,7 @@ Section "Uninstall" | @@ -107,7 +107,7 @@ Section "Uninstall" | ||
107 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\hllapi" | 107 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\hllapi" |
108 | DeleteRegKey HKLM "Software\hllapi" | 108 | DeleteRegKey HKLM "Software\hllapi" |
109 | 109 | ||
110 | - SetRegView 32 | 110 | + SetRegView 64 |
111 | DeleteRegKey HKLM "Software\hllapi" | 111 | DeleteRegKey HKLM "Software\hllapi" |
112 | 112 | ||
113 | SectionEnd | 113 | SectionEnd |
win/pack.sh
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | PROJECT_DIR=$(readlink -f $(dirname $(dirname $(readlink -f $0)))) | 2 | PROJECT_DIR=$(readlink -f $(dirname $(dirname $(readlink -f $0)))) |
3 | 3 | ||
4 | PUBLISH=0 | 4 | PUBLISH=0 |
5 | +CLEAR_OLD=0 | ||
5 | 6 | ||
6 | pack() { | 7 | pack() { |
7 | 8 | ||
@@ -11,7 +12,8 @@ pack() { | @@ -11,7 +12,8 @@ pack() { | ||
11 | 12 | ||
12 | BUILDDIR=$(mktemp -d) | 13 | BUILDDIR=$(mktemp -d) |
13 | 14 | ||
14 | - ./configure --cache=.${1}.cache \ | 15 | + ./configure \ |
16 | + --cache=.${1}.cache \ | ||
15 | --host=${1}-w64-mingw32 \ | 17 | --host=${1}-w64-mingw32 \ |
16 | --prefix=/usr/${1}-w64-mingw32/sys-root/mingw \ | 18 | --prefix=/usr/${1}-w64-mingw32/sys-root/mingw \ |
17 | --bindir=${BUILDDIR} \ | 19 | --bindir=${BUILDDIR} \ |
@@ -54,19 +56,27 @@ pack() { | @@ -54,19 +56,27 @@ pack() { | ||
54 | exit -1 | 56 | exit -1 |
55 | fi | 57 | fi |
56 | 58 | ||
57 | - if [ -d ~/public_html ]; then | ||
58 | - mkdir -p ~/public_html/win | ||
59 | - cp -v *.exe ~/public_html/win | ||
60 | - if [ "$?" != "0" ]; then | ||
61 | - exit -1 | 59 | + PRODUCT_NAME=$(${1}-w64-mingw32-pkg-config --variable=product_name lib3270) |
60 | + | ||
61 | + if [ ! -z ${PRODUCT_NAME} ]; then | ||
62 | + | ||
63 | + if [ -d ~/public_html/win/${PRODUCT_NAME}/${2} ]; then | ||
64 | + | ||
65 | + if [ "${CLEAR_OLD}" == "1" ]; then | ||
66 | + rm -fr ~/public_html/win/${PRODUCT_NAME}/${2}/hllapi-*.exe | ||
67 | + fi | ||
68 | + | ||
69 | + cp -v *.exe ~/public_html/win/${PRODUCT_NAME}/${2} | ||
70 | + | ||
62 | fi | 71 | fi |
63 | - fi | ||
64 | 72 | ||
65 | - if [ "${PUBLISH}" == "1" ] && [ ! -z ${WIN_PACKAGE_SERVER} ]; then | ||
66 | - scp *.exe ${WIN_PACKAGE_SERVER} | ||
67 | - if [ "$?" != "0" ]; then | ||
68 | - exit -1 | 73 | + if [ "${PUBLISH}" == "1" ] && [ ! -z ${WIN_PACKAGE_SERVER} ]; then |
74 | + echo scp *.exe ${WIN_PACKAGE_SERVER}/${PRODUCT_NAME}/${2} | ||
75 | + if [ "$?" != "0" ]; then | ||
76 | + exit -1 | ||
77 | + fi | ||
69 | fi | 78 | fi |
79 | + | ||
70 | fi | 80 | fi |
71 | 81 | ||
72 | mv -f *.exe ${PROJECT_DIR} | 82 | mv -f *.exe ${PROJECT_DIR} |
@@ -99,10 +109,7 @@ do | @@ -99,10 +109,7 @@ do | ||
99 | ;; | 109 | ;; |
100 | 110 | ||
101 | CLEAR) | 111 | CLEAR) |
102 | - if [ -d ~/public_html/win ]; then | ||
103 | - rm -fr ~/public_html/win/hllapi-*-{i686,x86_64}.exe | ||
104 | - fi | ||
105 | - | 112 | + CLEAR_OLD=1 |
106 | ;; | 113 | ;; |
107 | HELP) | 114 | HELP) |
108 | echo "${0} nome_da_matriz" | 115 | echo "${0} nome_da_matriz" |
@@ -137,7 +144,7 @@ if [ "$?" != "0" ]; then | @@ -137,7 +144,7 @@ if [ "$?" != "0" ]; then | ||
137 | exit -1 | 144 | exit -1 |
138 | fi | 145 | fi |
139 | 146 | ||
140 | -pack i686 | ||
141 | -pack x86_64 | 147 | +pack i686 x86_32 |
148 | +pack x86_64 x86_64 | ||
142 | 149 | ||
143 | 150 |