1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
|
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
|
+
|
case IDM_NEWSESS:
case IDM_DUPSESS:
case IDM_SAVEDSESS:
{
char b[2048];
char c[30], *cl;
int freecl = FALSE;
BOOL inherit_handles;
STARTUPINFO si;
PROCESS_INFORMATION pi;
HANDLE filemap = NULL;
if (wParam == IDM_DUPSESS) {
/*
* Allocate a file-mapping memory chunk for the
|
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
|
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
|
+
+
-
+
+
+
-
+
|
FILE_MAP_WRITE,
0, 0, sizeof(Config));
if (p) {
*p = cfg; /* structure copy */
UnmapViewOfFile(p);
}
}
inherit_handles = TRUE;
sprintf(c, "putty &%p", filemap);
cl = c;
} else if (wParam == IDM_SAVEDSESS) {
unsigned int sessno = ((lParam - IDM_SAVED_MIN)
/ MENU_SAVED_STEP) + 1;
if (sessno < sesslist.nsessions) {
char *session = sesslist.sessions[sessno];
/* XXX spaces? quotes? "-load"? */
cl = dupprintf("putty @%s", session);
inherit_handles = FALSE;
freecl = TRUE;
} else
break;
} else
} else /* IDM_NEWSESS */ {
cl = NULL;
inherit_handles = FALSE;
}
GetModuleFileName(NULL, b, sizeof(b) - 1);
si.cb = sizeof(si);
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = 0;
si.cbReserved2 = 0;
si.lpReserved2 = NULL;
CreateProcess(b, cl, NULL, NULL, TRUE,
CreateProcess(b, cl, NULL, NULL, inherit_handles,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
if (filemap)
CloseHandle(filemap);
if (freecl)
sfree(cl);
}
|