Commit fad6aa49a1d3eeec81fcd7690bf4d9f8d6d05fd9

Authored by perry.werneck@gmail.com
1 parent 7e3238e2

Pequenos ajustes no módulo hllapi

Showing 2 changed files with 12 additions and 12 deletions   Show diff stats
@@ -396,15 +396,9 @@ @@ -396,15 +396,9 @@
396 <Unit filename="src/plugins/hllapi/hllapi.c"> 396 <Unit filename="src/plugins/hllapi/hllapi.c">
397 <Option compilerVar="CC" /> 397 <Option compilerVar="CC" />
398 </Unit> 398 </Unit>
399 - <Unit filename="src/plugins/hllapi/pipesource.c">  
400 - <Option compilerVar="CC" />  
401 - </Unit>  
402 <Unit filename="src/plugins/hllapi/pluginmain.c"> 399 <Unit filename="src/plugins/hllapi/pluginmain.c">
403 <Option compilerVar="CC" /> 400 <Option compilerVar="CC" />
404 </Unit> 401 </Unit>
405 - <Unit filename="src/plugins/hllapi/remote.c">  
406 - <Option compilerVar="CC" />  
407 - </Unit>  
408 <Unit filename="src/plugins/hllapi/remotectl.h" /> 402 <Unit filename="src/plugins/hllapi/remotectl.h" />
409 <Unit filename="src/plugins/hllapi/server.h" /> 403 <Unit filename="src/plugins/hllapi/server.h" />
410 <Unit filename="src/plugins/hllapi/testprogram.c"> 404 <Unit filename="src/plugins/hllapi/testprogram.c">
src/classlib/remote.cc
@@ -131,16 +131,22 @@ @@ -131,16 +131,22 @@
131 131
132 string query_string(void *query, size_t szQuery, size_t len) 132 string query_string(void *query, size_t szQuery, size_t len)
133 { 133 {
134 - struct hllapi_packet_text * response;  
135 - DWORD cbSize = sizeof(struct hllapi_packet_text)+len;  
136 - string s;  
137 - char buffer[cbSize+2]; 134 + struct hllapi_packet_text * response;
  135 + DWORD sz = sizeof(struct hllapi_packet_text)+len;
  136 + DWORD cbSize = (DWORD) sz;
  137 + string s;
  138 + char buffer[sz+2];
  139 +
  140 + memset(buffer,0,sz+2);
138 141
139 response = (struct hllapi_packet_text *) buffer; 142 response = (struct hllapi_packet_text *) buffer;
140 143
141 - if(TransactNamedPipe(hPipe,(LPVOID) query, szQuery, response, cbSize, &cbSize,NULL)) 144 + if(TransactNamedPipe(hPipe,(LPVOID) query, szQuery, response, sz, &cbSize,NULL))
142 { 145 {
143 - buffer[cbSize] = 0; 146 + buffer[min(cbSize,sz)] = 0;
  147 +
  148 + trace("TransactNamedPipe call %d returns \"%s\"",(int) *( (unsigned char *) query), response->text);
  149 +
144 if(!response->packet_id) 150 if(!response->packet_id)
145 s.assign(response->text); 151 s.assign(response->text);
146 } 152 }