Fixes to some issues

This commit is contained in:
manojampalam 2016-10-19 23:38:41 -07:00
parent 6239a2847b
commit bc83d7d29e
2 changed files with 7 additions and 6 deletions

View File

@ -90,8 +90,8 @@ BOOL WINAPI ctrl_c_handler(
return TRUE;
}
int main(int argc, char **argv) {
int wmain(int argc, wchar_t **argv) {
w32posix_initialize();
load_config();
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
@ -108,7 +108,7 @@ int main(int argc, char **argv) {
if (argc == 2) {
/*agent process is likely a spawned child*/
char* h = 0;
h += atoi(*(argv + 1));
h += _wtoi(*(argv + 1));
if (h != 0) {
log_init("ssh-agent", config_log_level(), 1, 0);
agent_start(FALSE, TRUE, h);
@ -146,7 +146,7 @@ int scm_start_service(DWORD num, LPWSTR* args) {
ZeroMemory(&service_status, sizeof(service_status));
service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR, 300);
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
log_init("ssh-agent", config_log_level(), 1, 0);
agent_start(FALSE, FALSE, 0);
return 0;

View File

@ -552,7 +552,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
memcpy(c, command, strlen(command));
c += strlen(command);
}
*c == '\0';
*c = '\0';
}
/* setup Environment varibles */
@ -561,7 +561,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
char buf[128];
char* laddr;
if ((tmp == utf8_to_utf16(s->pw->pw_name)) != NULL)
if ((tmp = utf8_to_utf16(s->pw->pw_name)) == NULL)
fatal("%s, out of memory");
SetEnvironmentVariableW(L"USERNAME", tmp);
free(tmp);
@ -579,6 +579,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
wchar_t wc = pw_dir_w[2];
pw_dir_w[2] = L'\0';
SetEnvironmentVariableW(L"HOMEDRIVE", pw_dir_w);
pw_dir_w[2] = wc;
}
snprintf(buf, sizeof buf, "%.50s %d %d",