diff --git a/po/pt_BR.po b/po/pt_BR.po index 82d0750..9c29e8a 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-12 07:56-0200\n" +"POT-Creation-Date: 2013-11-17 09:42-0200\n" "PO-Revision-Date: 2013-11-12 08:07-0200\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português \n" @@ -206,7 +206,7 @@ msgstr "Sobre a segurança" msgid "Action failed" msgstr "Ação falhou" -#: ui/00default.xml:329 +#: ui/00default.xml:64 msgid "Add to copy" msgstr "Adicionar à cópia" @@ -214,7 +214,7 @@ msgstr "Adicionar à cópia" msgid "Add/Remove _CR at end of line" msgstr "Adicionar/Remover _CR no final da linha" -#: ui/00default.xml:397 +#: ui/00default.xml:132 msgid "Alert sound" msgstr "Aviso sonoro" @@ -227,7 +227,7 @@ msgstr "" msgid "Application name" msgstr "Nome da aplicação" -#: ui/10keypad.xml:155 +#: ui/10keypad.xml:454 msgid "Attn" msgstr "Attn" @@ -244,7 +244,7 @@ msgstr "Divergência nos números de série da autoridade e emissor " msgid "Authority and subject key identifier mismatch" msgstr "Authority and subject key identifier mismatch" -#: ui/00default.xml:392 +#: ui/00default.xml:127 msgid "Auto-Reconnect" msgstr "Reconectar automaticamente" @@ -268,11 +268,11 @@ msgstr "Versão winsock inválida" msgid "Black" msgstr "Preto" -#: ui/00default.xml:390 +#: ui/00default.xml:125 msgid "Blank Fill" msgstr "Completar com espaços" -#: ui/00default.xml:383 +#: ui/00default.xml:118 msgid "Blinking Cursor" msgstr "Cursor piscante" @@ -280,7 +280,7 @@ msgstr "Cursor piscante" msgid "Blue" msgstr "Azul" -#: ui/00default.xml:393 +#: ui/00default.xml:128 msgid "Bold" msgstr "Negrito" @@ -288,7 +288,7 @@ msgstr "Negrito" msgid "Brazilian Public Software Portal" msgstr "Portal do Software Público Brasileiro" -#: ui/10keypad.xml:156 +#: ui/10keypad.xml:455 msgid "Break" msgstr "Break" @@ -484,7 +484,7 @@ msgstr "Falha na assinatura do certificado" msgid "Charset error" msgstr "Erro de codificação de caracteres" -#: ui/10keypad.xml:147 +#: ui/00default.xml:79 msgid "Clear" msgstr "Limpar" @@ -496,7 +496,7 @@ msgstr "Tema de cores:" msgid "Color setup" msgstr "Configuração de cores" -#: ui/00default.xml:372 +#: ui/00default.xml:107 msgid "Colors" msgstr "Cores" @@ -508,7 +508,7 @@ msgstr "Command:" msgid "Complete" msgstr "Completo" -#: ui/00default.xml:382 +#: ui/00default.xml:117 msgid "Connect on startup" msgstr "Conectar ao iniciar" @@ -516,19 +516,19 @@ msgstr "Conectar ao iniciar" msgid "Connection reset by peer" msgstr "Conexão foi cancelada pelo servidor" -#: ui/00default.xml:326 +#: ui/00default.xml:61 msgid "Copy" msgstr "Copiar" -#: ui/99debug.xml:200 +#: ui/99debug.xml:342 msgid "Copy as HTML" msgstr "Copiar como HTML" -#: ui/00default.xml:327 +#: ui/00default.xml:62 msgid "Copy as table" msgstr "Copiar como tabela" -#: colors.c:460 ui/00default.xml:389 +#: colors.c:460 ui/00default.xml:124 msgid "Cross hair cursor" msgstr "Cursor mira" @@ -541,7 +541,7 @@ msgstr "Atual (%s)" msgid "Custom colors" msgstr "Cores personalizadas" -#: ui/00default.xml:330 +#: ui/00default.xml:65 msgid "Cut" msgstr "Recortar" @@ -553,7 +553,7 @@ msgstr "Cilindros" msgid "DFT B_uffer size:" msgstr "Tamanho do b_uffer DFT:" -#: ui/99debug.xml:205 +#: ui/99debug.xml:347 msgid "DS Trace" msgstr "DS Trace" @@ -569,11 +569,11 @@ msgstr "Verde Escuro" msgid "Data conversion error" msgstr "Erro na conversão de dados" -#: ui/99debug.xml:213 +#: ui/99debug.xml:355 msgid "Debug" msgstr "Depuração" -#: ui/99debug.xml:216 +#: ui/99debug.xml:358 msgid "Debug window updates" msgstr "Mostrar atualizações de janela" @@ -581,7 +581,7 @@ msgstr "Mostrar atualizações de janela" msgid "Default" msgstr "Padrão" -#: ui/00default.xml:346 +#: ui/00default.xml:81 msgid "Delete field" msgstr "Apagar campo" @@ -593,7 +593,7 @@ msgstr "Tipo de dispositivo rejeitado" msgid "Disconnected from host" msgstr "Desconectado do servidor" -#: ui/99debug.xml:214 +#: ui/99debug.xml:356 msgid "Display current charset" msgstr "Mostrar a tabela de caracteres ativa" @@ -617,7 +617,7 @@ msgstr "Nome do servidor em branco" msgid "Empty port name" msgstr "Porta em branco" -#: ui/10keypad.xml:151 +#: ui/10keypad.xml:450 msgid "" "Erase\n" "EOF" @@ -625,7 +625,7 @@ msgstr "" "Apagar\n" "Campo" -#: ui/10keypad.xml:152 +#: ui/10keypad.xml:451 msgid "" "Erase\n" "Input" @@ -633,15 +633,15 @@ msgstr "" "Apagar\n" "Campos" -#: ui/00default.xml:345 +#: ui/00default.xml:80 msgid "Erase input" msgstr "Apagar campos" -#: ui/00default.xml:347 +#: ui/00default.xml:82 msgid "Erase to end of field" msgstr "Apagar até o final do campo" -#: ui/00default.xml:348 +#: ui/00default.xml:83 msgid "Erase to end of line" msgstr "Apagar até o final da linha" @@ -684,11 +684,11 @@ msgstr "Erro lendo %s" msgid "Error resolving %s: %s" msgstr "Erro ao resolver %s: %s" -#: ui/99debug.xml:207 +#: ui/99debug.xml:349 msgid "Event Trace" msgstr "Trace de eventos" -#: ui/80rexx.xml:261 +#: ui/80rexx.xml:303 msgid "External Rexx script" msgstr "Script rexx externo" @@ -732,11 +732,11 @@ msgstr "Erro de formato no campo \"notAfter\" do certificado" msgid "Format error in certificate's notBefore field" msgstr "Erro de formato no campo \"notBefore\" do certificado" -#: ui/00default.xml:386 +#: ui/00default.xml:121 msgid "Full Screen" msgstr "Tela cheia" -#: ui/10functions.xml:35 +#: ui/10functions.xml:499 msgid "Function bar" msgstr "Barra de funções" @@ -781,7 +781,7 @@ msgstr "HTTP Proxy: EOF inesperado" msgid "HTTP Proxy: unrecognized reply" msgstr "HTTP Proxy: Resposta desconhecida" -#: ui/00default.xml:408 +#: ui/00default.xml:143 msgid "Help" msgstr "Ajuda" @@ -842,7 +842,7 @@ msgstr "Comprimento de frame inválido" msgid "Informations" msgstr "Informações" -#: ui/00default.xml:403 +#: ui/00default.xml:138 msgid "Input method" msgstr "Método de entrada" @@ -879,7 +879,7 @@ msgstr "Sintaxe de proxy inválida" msgid "Invalid proxy type '%.*s'" msgstr "Tipo de proxy invalido '%.*s'" -#: ui/00default.xml:395 +#: ui/00default.xml:130 msgid "Keep selected" msgstr "Manter selecionado" @@ -895,7 +895,7 @@ msgstr "Teclado está bloqueado" msgid "LRECL:" msgstr "LRECL:" -#: ui/10keypad.xml:101 +#: ui/10keypad.xml:400 msgid "Lateral keypad" msgstr "Barra lateral" @@ -916,7 +916,7 @@ msgstr "Faltando ']'" msgid "Model %d (%s)" msgstr "Modelo %d (%s)" -#: ui/00default.xml:384 +#: ui/00default.xml:119 msgid "Monocase" msgstr "Só Maiúsculas" @@ -948,7 +948,7 @@ msgstr "N/A" msgid "Network error" msgstr "Erro de rede" -#: ui/00default.xml:399 +#: ui/00default.xml:134 msgid "Network keep alive" msgstr "Network keep alive" @@ -956,7 +956,7 @@ msgstr "Network keep alive" msgid "Network startup error" msgstr "Erro ao iniciar a rede" -#: ui/00default.xml:455 +#: ui/00default.xml:190 msgid "Next field" msgstr "Próximo campo" @@ -1033,111 +1033,111 @@ msgstr "Outro (VM/CMS)" msgid "Out of memory" msgstr "Memória insuficiente" -#: ui/10keypad.xml:138 +#: ui/10keypad.xml:437 msgid "PA1" msgstr "PA1" -#: ui/10keypad.xml:139 +#: ui/10keypad.xml:438 msgid "PA2" msgstr "PA2" -#: ui/10keypad.xml:140 +#: ui/10keypad.xml:439 msgid "PA3" msgstr "PA3" -#: ui/10functions.xml:36 +#: ui/10keypad.xml:402 msgid "PF1" msgstr "PF1" -#: ui/10functions.xml:45 +#: ui/10keypad.xml:417 msgid "PF10" msgstr "PF10" -#: ui/10functions.xml:46 +#: ui/10keypad.xml:418 msgid "PF11" msgstr "PF11" -#: ui/10functions.xml:47 +#: ui/10keypad.xml:419 msgid "PF12" msgstr "PF12" -#: ui/10functions.xml:50 +#: ui/10functions.xml:514 msgid "PF13" msgstr "PF13" -#: ui/10functions.xml:51 +#: ui/10functions.xml:515 msgid "PF14" msgstr "PF14" -#: ui/10functions.xml:52 +#: ui/10functions.xml:516 msgid "PF15" msgstr "PF15" -#: ui/10functions.xml:53 +#: ui/10functions.xml:517 msgid "PF16" msgstr "PF16" -#: ui/10functions.xml:54 +#: ui/10functions.xml:518 msgid "PF17" msgstr "PF17" -#: ui/10functions.xml:55 +#: ui/10functions.xml:519 msgid "PF18" msgstr "PF18" -#: ui/10functions.xml:56 +#: ui/10functions.xml:520 msgid "PF19" msgstr "PF19" -#: ui/10functions.xml:37 +#: ui/10keypad.xml:403 msgid "PF2" msgstr "PF2" -#: ui/10functions.xml:57 +#: ui/10functions.xml:521 msgid "PF20" msgstr "PF20" -#: ui/10functions.xml:58 +#: ui/10functions.xml:522 msgid "PF21" msgstr "PF21" -#: ui/10functions.xml:59 +#: ui/10functions.xml:523 msgid "PF22" msgstr "PF22" -#: ui/10functions.xml:60 +#: ui/10functions.xml:524 msgid "PF23" msgstr "PF23" -#: ui/10functions.xml:61 +#: ui/10functions.xml:525 msgid "PF24" msgstr "PF24" -#: ui/10functions.xml:38 +#: ui/10keypad.xml:404 msgid "PF3" msgstr "PF3" -#: ui/10functions.xml:39 +#: ui/10keypad.xml:407 msgid "PF4" msgstr "PF4" -#: ui/10functions.xml:40 +#: ui/10keypad.xml:408 msgid "PF5" msgstr "PF5" -#: ui/10functions.xml:41 +#: ui/10keypad.xml:409 msgid "PF6" msgstr "PF6" -#: ui/10functions.xml:42 +#: ui/10keypad.xml:412 msgid "PF7" msgstr "PF7" -#: ui/10functions.xml:43 +#: ui/10keypad.xml:413 msgid "PF8" msgstr "PF8" -#: ui/10functions.xml:44 +#: ui/10keypad.xml:414 msgid "PF9" msgstr "PF9" @@ -1154,15 +1154,15 @@ msgstr "Erro de interpretação em %s" msgid "Passthru Proxy: send error" msgstr "Passthru Proxy: Erro ao enviar" -#: ui/00default.xml:331 +#: ui/00default.xml:66 msgid "Paste" msgstr "Colar" -#: ui/00default.xml:332 +#: ui/00default.xml:67 msgid "Paste next" msgstr "Colar próximo" -#: ui/00default.xml:335 +#: ui/00default.xml:70 msgid "Paste text file" msgstr "Colar arquivo texto" @@ -1170,7 +1170,7 @@ msgstr "Colar arquivo texto" msgid "Paste text file contents" msgstr "Colar conteúdo de arquivo texto" -#: ui/00default.xml:388 +#: ui/00default.xml:123 msgid "Paste with left margin" msgstr "Colar com margem esquerda" @@ -1186,7 +1186,7 @@ msgstr "Caminho para os arquivos de dados da aplicação" msgid "Pink" msgstr "Rosa" -#: ui/00default.xml:454 +#: ui/00default.xml:189 msgid "Previous field" msgstr "Campo anterior" @@ -1194,11 +1194,11 @@ msgstr "Campo anterior" msgid "Primary space:" msgstr "Primary space:" -#: ui/00default.xml:314 +#: ui/00default.xml:49 msgid "Print" msgstr "Imprimir" -#: ui/00default.xml:316 +#: ui/00default.xml:51 msgid "Print copy" msgstr "Imprimir cópia" @@ -1206,7 +1206,7 @@ msgstr "Imprimir cópia" msgid "Print operation failed" msgstr "Operação de impressão falhou" -#: ui/00default.xml:315 +#: ui/00default.xml:50 msgid "Print selected" msgstr "Imprimir seleção" @@ -1214,7 +1214,7 @@ msgstr "Imprimir seleção" msgid "Print selection box" msgstr "Imprimir marca de seleção" -#: print.c:907 ui/00default.xml:373 +#: print.c:907 ui/00default.xml:108 msgid "Print settings" msgstr "Configurações de impressão" @@ -1226,7 +1226,7 @@ msgstr "Progresso" msgid "Purple" msgstr "Púrpura" -#: ui/00default.xml:322 +#: ui/00default.xml:57 msgid "Quit" msgstr "Sair" @@ -1306,7 +1306,7 @@ msgstr "RPQ: Não foi possível resolver '%s': %s" msgid "RPQ: gethostbyname error" msgstr "RPQ: Erro em gethostbyname" -#: ui/00default.xml:319 +#: ui/00default.xml:54 msgid "Receive file" msgstr "Receber arquivo" @@ -1322,27 +1322,27 @@ msgstr "Formato de registro" msgid "Red" msgstr "Vermelho" -#: ui/99debug.xml:215 +#: ui/99debug.xml:357 msgid "Reload buffer contents" msgstr "Recarregar conteúdo do buffer" -#: ui/00default.xml:340 +#: ui/00default.xml:75 msgid "Remove selection" msgstr "Remover seleção" -#: ui/00default.xml:341 +#: ui/00default.xml:76 msgid "Reselect" msgstr "Reselecionar" -#: ui/10keypad.xml:148 +#: ui/10keypad.xml:447 msgid "Reset" msgstr "Reset" -#: ui/00default.xml:387 +#: ui/00default.xml:122 msgid "Resize on alternate screen" msgstr "Mudar tamanho do terminal em tela alternativa" -#: ui/00default.xml:456 +#: ui/00default.xml:191 msgid "Return" msgstr "Return" @@ -1503,7 +1503,7 @@ msgstr "" "SSL_write:\n" "%s" -#: ui/00default.xml:311 +#: ui/00default.xml:46 msgid "Save copy" msgstr "Salvar cópia" @@ -1511,7 +1511,7 @@ msgstr "Salvar cópia" msgid "Save copy to file" msgstr "Salvar cópia para arquivo" -#: ui/00default.xml:309 +#: ui/00default.xml:44 msgid "Save screen" msgstr "Salvar tela" @@ -1519,7 +1519,7 @@ msgstr "Salvar tela" msgid "Save screen to file" msgstr "Salvar tela para arquivo" -#: ui/00default.xml:310 +#: ui/00default.xml:45 msgid "Save selected" msgstr "Salvar seleção" @@ -1531,15 +1531,15 @@ msgstr "Salvar seleção para arquivo" msgid "Save trace file" msgstr "Salvar arquivo de trace" -#: ui/99debug.xml:206 +#: ui/99debug.xml:348 msgid "Screen Trace" msgstr "Trace de tela" -#: ui/00default.xml:379 +#: ui/00default.xml:114 msgid "Screen size" msgstr "Tamanho da tela" -#: ui/80rexx.xml:261 +#: ui/00default.xml:89 msgid "Scripts" msgstr "Scripts" @@ -1551,15 +1551,15 @@ msgstr "Secondary space:" msgid "Secure connection was successful." msgstr "Conexão segura efetuada com sucesso." -#: ui/00default.xml:339 +#: ui/00default.xml:74 msgid "Select Field" msgstr "Selecionar campo" -#: ui/00default.xml:338 +#: ui/00default.xml:73 msgid "Select all" msgstr "Selecionar tudo" -#: ui/00default.xml:391 +#: ui/00default.xml:126 msgid "Select by rectangles" msgstr "Seleção retangular" @@ -1571,7 +1571,7 @@ msgstr "Selecione arquivo a receber" msgid "Select file to send" msgstr "Selecione arquivo a enviar" -#: ui/00default.xml:376 +#: ui/00default.xml:111 msgid "Select font" msgstr "Selecione fonte" @@ -1595,7 +1595,7 @@ msgstr "Certificado auto assinado" msgid "Self signed certificate in certificate chain" msgstr "Certificado auto assinado na cadeia de certificados" -#: ui/00default.xml:320 +#: ui/00default.xml:55 msgid "Send file" msgstr "Enviar arquivo" @@ -1607,7 +1607,7 @@ msgstr "Enviar arquivo para o servidor" msgid "Send messages to syslog" msgstr "Enviar mensagens para o log do sistema" -#: ui/00default.xml:319 +#: ui/00default.xml:54 msgid "Send/Receive" msgstr "Enviar/Receber" @@ -1619,7 +1619,7 @@ msgstr "Nome da sessão" msgid "Set host charset" msgstr "Define página de código do host" -#: ui/00default.xml:357 +#: ui/00default.xml:92 msgid "Set hostname" msgstr "Selecione servidor" @@ -1639,19 +1639,19 @@ msgstr "Ativa toggles" msgid "Set trace filename" msgstr "Define o nome do arquivo de trace" -#: ui/00default.xml:372 +#: ui/00default.xml:107 msgid "Settings" msgstr "Configurações" -#: ui/00default.xml:394 +#: ui/00default.xml:129 msgid "Show Underline" msgstr "Mostrar sublinhado" -#: ui/99debug.xml:213 +#: ui/99debug.xml:355 msgid "Show test pattern" msgstr "Mostrar padrão de teste" -#: ui/00default.xml:396 +#: ui/00default.xml:131 msgid "Smart paste" msgstr "Colar inteligente" @@ -1935,15 +1935,15 @@ msgid "" "This version of %s was built without support for secure sockets layer (SSL)." msgstr "Esta versão do %s foi gerada sem suporte para conexões seguras (SSL)." -#: ui/00default.xml:414 +#: ui/00default.xml:149 msgid "Toolbar" msgstr "Barra de ferramentas" -#: ui/99debug.xml:205 +#: ui/99debug.xml:347 msgid "Trace" msgstr "Trace" -#: ui/00default.xml:385 +#: ui/00default.xml:120 msgid "Track Cursor" msgstr "Mostrar posição do cursor" @@ -2156,7 +2156,7 @@ msgstr "Unsupported passthru host session" msgid "Unsupported socks 4 proxy" msgstr "Unsupported socks 4 proxy" -#: ui/00default.xml:398 +#: ui/00default.xml:133 msgid "Use +/- for field navigation" msgstr "Usar teclas +/- para navegar por campos" @@ -2169,7 +2169,7 @@ msgstr "Variável" msgid "Version %s - Revision %s" msgstr "Versão %s - Revisão %s" -#: ui/99debug.xml:208 +#: ui/99debug.xml:350 msgid "View Field Delimiters" msgstr "Mostrar delimitadores de campo" @@ -2197,7 +2197,7 @@ msgstr "Europa ocidental (ISO 8859-1)" msgid "White" msgstr "Branco" -#: ui/00default.xml:425 +#: ui/00default.xml:160 msgid "Window" msgstr "Janela" @@ -2265,19 +2265,19 @@ msgstr "_Procurar" msgid "_Color table:" msgstr "Tabela de cores:" -#: ui/00default.xml:367 +#: ui/00default.xml:102 msgid "_Connect" msgstr "_Conectar" -#: ui/00default.xml:368 +#: ui/00default.xml:103 msgid "_Disconnect" msgstr "_Desconectar" -#: ui/99debug.xml:200 +#: ui/00default.xml:61 msgid "_Edit" msgstr "_Editar" -#: ui/80rexx.xml:257 +#: ui/00default.xml:36 msgid "_File" msgstr "_Arquivo" @@ -2305,11 +2305,11 @@ msgstr "Nome do _Host:" msgid "_Local file name:" msgstr "Arquivo _local:" -#: ui/00default.xml:357 +#: ui/00default.xml:92 msgid "_Network" msgstr "_Rede" -#: ui/00default.xml:382 +#: ui/00default.xml:117 msgid "_Options" msgstr "_Opções" @@ -2337,7 +2337,7 @@ msgstr "Arquivo _texto" msgid "_To" msgstr "_Para" -#: ui/80rexx.xml:259 +#: ui/00default.xml:87 msgid "_View" msgstr "_Exibir" diff --git a/pw3270-i686.nsi.in b/pw3270-i686.nsi.in index 5a3fd25..218903b 100644 --- a/pw3270-i686.nsi.in +++ b/pw3270-i686.nsi.in @@ -88,7 +88,8 @@ SubSection "@PACKAGE@" SecMain file "/oname=$INSTDIR\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" ".bin\Release\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" # Save DataDir - WriteRegStr HKLM "Software\@PACKAGE@" "datadir" $INSTDIR + WriteRegStr HKLM "Software\@PACKAGE@" "datadir" "$INSTDIR" + WriteRegStr HKLM "Software\@PACKAGE@" "appName" "$INSTDIR\@PACKAGE@.exe" # define uninstaller name writeUninstaller $INSTDIR\uninstall.exe diff --git a/pw3270-x86_64.nsi.in b/pw3270-x86_64.nsi.in index 2d65ae1..690d9d2 100644 --- a/pw3270-x86_64.nsi.in +++ b/pw3270-x86_64.nsi.in @@ -91,7 +91,8 @@ SubSection "@PACKAGE@" SecMain # Save DataDir SetRegView 64 - WriteRegStr HKLM "Software\@PACKAGE@" "datadir" $INSTDIR + WriteRegStr HKLM "Software\@PACKAGE@" "datadir" "$INSTDIR" + WriteRegStr HKLM "Software\@PACKAGE@" "appName" "$INSTDIR\@PACKAGE@.exe" # define uninstaller name SetRegView 32 diff --git a/src/plugins/hllapi/calls.c b/src/plugins/hllapi/calls.c index 42e74dc..ad98198 100644 --- a/src/plugins/hllapi/calls.c +++ b/src/plugins/hllapi/calls.c @@ -35,6 +35,8 @@ #include #include #include + #include + #include #include "client.h" #undef trace @@ -114,124 +116,209 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ - __declspec (dllexport) DWORD __stdcall hllapi_init(LPSTR mode) + static DWORD load_remote(void) { - if(!mode) - return HLLAPI_STATUS_SYSTEM_ERROR; + // Get pointers to the pipe based calls + int f; - trace("%s(%s)",__FUNCTION__,(char *) mode); + trace("%s: Loading pipe based calls",__FUNCTION__); + for(f=0;entry_point[f].name;f++) + *entry_point[f].call = entry_point[f].pipe; - if(mode && *mode) + return HLLAPI_STATUS_SUCCESS; + } + + static DWORD start_session(void) + { + char buffer[80]; + char appName[4096]; + HKEY hKey = 0; + unsigned long datalen = 4096; + DWORD ret; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + // Get application path + *appName = 0; + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\pw3270",0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS) { - // Get pointers to the pipe based calls - int f; + unsigned long datatype; // #defined in winnt.h (predefined types 0-11) + if(RegQueryValueExA(hKey,"appName",NULL,&datatype,(LPBYTE) appName,&datalen) != ERROR_SUCCESS) + *appName = 0; + RegCloseKey(hKey); + } + + trace("%s appname=%s\n",__FUNCTION__,appName); + + snprintf(buffer,79,"%s --session=\"H%06d\"",appName,getpid()); - trace("%s: Loading pipe based calls",__FUNCTION__); - for(f=0;entry_point[f].name;f++) - *entry_point[f].call = entry_point[f].pipe; + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + // si.dwFlags = STARTF_PREVENTPINNING; + trace("App: %s",appName); + trace("CmdLine: %s",buffer); + + if(!CreateProcess(NULL,buffer,NULL,NULL,0,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi)) + return GetLastError(); + + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); + + // Wait for pipe to be available + time_t timer = time(0)+5; + HANDLE hPipe = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA FindFileData; + + snprintf(buffer,4095,"\\\\.\\pipe\\H%06d_a",getpid()); + + while(hPipe == INVALID_HANDLE_VALUE && time(0) < timer) + { + Sleep(10); + hPipe = FindFirstFile(buffer, &FindFileData); } - else + + if(hPipe == INVALID_HANDLE_VALUE) + return - ETIMEDOUT; + + CloseHandle(hPipe); + + // Load PIPE calls for the created session + snprintf(buffer,79,"H%06d:a",getpid()); + ret = load_remote(); + if(ret) + return ret; + + snprintf(buffer,79,"H%06d:A",getpid()); + hSession = session_new((const char *) buffer); + trace("%s ok hSession=%p\n",__FUNCTION__,hSession); + + return hSession ? HLLAPI_STATUS_SUCCESS : HLLAPI_STATUS_SYSTEM_ERROR; + } + + static DWORD load_dll(void) + { + // Direct mode, load lib3270.dll, get pointers to the calls + static const char *dllname = "lib3270.dll." PACKAGE_VERSION; + + int f; + HMODULE kernel; + HANDLE cookie = NULL; + DWORD rc; + HANDLE (*AddDllDirectory)(PCWSTR NewDirectory); + BOOL (*RemoveDllDirectory)(HANDLE Cookie); + UINT errorMode; + char datadir[4096]; + + trace("hModule=%p",hModule); + if(hModule) + return -EBUSY; + + kernel = LoadLibrary("kernel32.dll"); + AddDllDirectory = (HANDLE (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory"); + RemoveDllDirectory = (BOOL (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory"); + + // Notify user in case of error loading protocol DLL + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx + errorMode = SetErrorMode(1); + + memset(datadir,' ',4095); + datadir[4095] = 0; + + if(hllapi_get_datadir(datadir)) { - // Direct mode, load lib3270.dll, get pointers to the calls - static const char *dllname = "lib3270.dll." PACKAGE_VERSION; - - int f; - HMODULE kernel; - HANDLE cookie = NULL; - DWORD rc; - HANDLE (*AddDllDirectory)(PCWSTR NewDirectory); - BOOL (*RemoveDllDirectory)(HANDLE Cookie); - UINT errorMode; - char datadir[4096]; - - trace("hModule=%p",hModule); - if(hModule) - return -EBUSY; - - kernel = LoadLibrary("kernel32.dll"); - AddDllDirectory = (HANDLE (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory"); - RemoveDllDirectory = (BOOL (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory"); - - // Notify user in case of error loading protocol DLL - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx - errorMode = SetErrorMode(1); - - memset(datadir,' ',4095); - datadir[4095] = 0; - - if(hllapi_get_datadir(datadir)) - { - char buffer[4096]; - wchar_t path[4096]; + char buffer[4096]; + wchar_t path[4096]; - mbstowcs(path, datadir, 4095); - trace("Datadir=[%s] AddDllDirectory=%p RemoveDllDirectory=%p\n",datadir,AddDllDirectory,RemoveDllDirectory); - if(AddDllDirectory) - cookie = AddDllDirectory(path); + mbstowcs(path, datadir, 4095); + trace("Datadir=[%s] AddDllDirectory=%p RemoveDllDirectory=%p\n",datadir,AddDllDirectory,RemoveDllDirectory); + if(AddDllDirectory) + cookie = AddDllDirectory(path); #ifdef DEBUG - snprintf(buffer,4096,"%s\\.bin\\Debug\\%s",datadir,dllname); + snprintf(buffer,4096,"%s\\.bin\\Debug\\%s",datadir,dllname); #else - snprintf(buffer,4096,"%s\\%s",datadir,dllname); + snprintf(buffer,4096,"%s\\%s",datadir,dllname); #endif // DEBUG - hModule = LoadLibrary(buffer); - - trace("%s hModule=%p rc=%d",buffer,hModule,(int) GetLastError()); + hModule = LoadLibrary(buffer); - if(hModule == NULL) - { - // Enable DLL error popup and try again with full path - SetErrorMode(0); - hModule = LoadLibraryEx(buffer,NULL,LOAD_LIBRARY_SEARCH_DEFAULT_DIRS|LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); - } + trace("%s hModule=%p rc=%d",buffer,hModule,(int) GetLastError()); - rc = GetLastError(); - - trace("%s hModule=%p rc=%d",buffer,hModule,(int) rc); - } - else + if(hModule == NULL) { - hModule = LoadLibrary(dllname); - rc = GetLastError(); + // Enable DLL error popup and try again with full path + SetErrorMode(0); + hModule = LoadLibraryEx(buffer,NULL,LOAD_LIBRARY_SEARCH_DEFAULT_DIRS|LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); } - SetErrorMode(errorMode); + rc = GetLastError(); + + trace("%s hModule=%p rc=%d",buffer,hModule,(int) rc); + } + else + { + hModule = LoadLibrary(dllname); + rc = GetLastError(); + } + + SetErrorMode(errorMode); - trace("%s hModule=%p rc=%d",dllname,hModule,(int) rc); + trace("%s hModule=%p rc=%d",dllname,hModule,(int) rc); - if(cookie && RemoveDllDirectory) - RemoveDllDirectory(cookie); + if(cookie && RemoveDllDirectory) + RemoveDllDirectory(cookie); - if(kernel) - FreeLibrary(kernel); + if(kernel) + FreeLibrary(kernel); - if(!hModule) - return rc; + if(!hModule) + return rc; - // Get library entry pointers - for(f=0;entry_point[f].name;f++) - { - void *ptr = (void *) GetProcAddress(hModule,entry_point[f].name); + // Get library entry pointers + for(f=0;entry_point[f].name;f++) + { + void *ptr = (void *) GetProcAddress(hModule,entry_point[f].name); - trace("%d %s=%p\n",f,entry_point[f].name,ptr); + trace("%d %s=%p\n",f,entry_point[f].name,ptr); - if(!ptr) - { - trace("Can´t load \"%s\"\n",entry_point[f].name); - hllapi_deinit(); - return -ENOENT; - } - *entry_point[f].call = ptr; + if(!ptr) + { + trace("Can´t load \"%s\"\n",entry_point[f].name); + hllapi_deinit(); + return -ENOENT; } + *entry_point[f].call = ptr; + } + + return HLLAPI_STATUS_SUCCESS; + } + + __declspec (dllexport) DWORD __stdcall hllapi_init(LPSTR mode) + { + if(!mode) + return HLLAPI_STATUS_SYSTEM_ERROR; + + trace("%s(%s)",__FUNCTION__,(char *) mode); + + if(mode && *mode) + { + if(strcasecmp(mode,"start") == 0 || strcasecmp(mode,"new") == 0) + return start_session(); + load_remote(); } + else + { + load_dll(); + } + // Get session handle hSession = session_new((const char *) mode); trace("%s ok hSession=%p\n",__FUNCTION__,hSession); - return hSession ? 0 : -1; + return hSession ? HLLAPI_STATUS_SUCCESS : HLLAPI_STATUS_SYSTEM_ERROR; } __declspec (dllexport) DWORD __stdcall hllapi_deinit(void) diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c index 91d40d5..68e6ed9 100644 --- a/src/plugins/hllapi/pluginmain.c +++ b/src/plugins/hllapi/pluginmain.c @@ -36,6 +36,7 @@ #include #include #include + #include /*--[ Defines ]--------------------------------------------------------------------------------------*/ @@ -306,11 +307,11 @@ case HLLAPI_PACKET_SET_HOST_CHARSET: send_result(source,lib3270_set_host_charset( lib3270_get_default_session_handle(), - (unsigned char *) ((struct hllapi_packet_set_text *) source->buffer)->text)); + (const char *) ((struct hllapi_packet_set_text *) source->buffer)->text)); break; case HLLAPI_PACKET_GET_HOST_CHARSET: - send_text(source,lib3270_get_host_charset(lib3270_get_default_session_handle())); + send_text(source,(char *) lib3270_get_host_charset(lib3270_get_default_session_handle())); break; default: diff --git a/src/plugins/hllapi/testprogram.c b/src/plugins/hllapi/testprogram.c index 7013bc8..63fabd2 100644 --- a/src/plugins/hllapi/testprogram.c +++ b/src/plugins/hllapi/testprogram.c @@ -38,7 +38,7 @@ int main(int numpar, char *param[]) { - const char *session = "pw3270:a"; + const char *session = "new"; printf("init(%s)=%d\n",session,(int) hllapi_init((LPSTR) session)); printf("revision=%d\n",(int) hllapi_get_revision()); -- libgit2 0.21.2