Quote Originally Posted by mmc01 View Post
How to use CreateProcess . I read example and try to use the function like this
Code:
DWORD WINAPI hidden_file(LPVOID lp)
{
	STARTUPINFO si;
    PROCESS_INFORMATION pi;

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

LPTSTR szCmdline1 = _tcsdup(TEXT("N:/Unhidden.exe"));
	CreateProcess(NULL, szCmdline1,  
		NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si,            // Pointer to STARTUPINFO structure
        &pi );


   return 0;
}
Why do you use _tcsdup?
You don't need to duplicate this string.
But if you do want to call _tcsdup then you must somewhere call
Code:
free(szCmdline1);
to avoid memory leaks!
Second: you don't check the return value of CreateProcess. Thus you don't know whether it failed or succeeded. And if it failed then all your other attempts to work with the Unhidden.exe do not make any sense!

Quote Originally Posted by mmc01 View Post
but when I send key Y with this code it run in visual studio 2010\Projects\

Code:
    ir[0].EventType = KEY_EVENT;
    ir[0].Event.KeyEvent.bKeyDown = TRUE;
    ir[0].Event.KeyEvent.dwControlKeyState = 0;
    ir[0].Event.KeyEvent.uChar.UnicodeChar = 'y';
    ir[0].Event.KeyEvent.wRepeatCount = 1;
    ir[0].Event.KeyEvent.wVirtualKeyCode = 'Y';
    ir[0].Event.KeyEvent.wVirtualScanCode = MapVirtualKey('Y', MAPVK_VK_TO_VSC);
[/CODE]
Where do you send key Y to? You didn't write anything about sending keys...
And what is ir[...]?


Quote Originally Posted by mmc01 View Post
And if I use this code it not show anything in command window.

Code:
LPTSTR szCmdline1 = _tcsdup(TEXT("N:"));
	CreateProcess(NULL, szCmdline1,  
		NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si,            // Pointer to STARTUPINFO structure
        &pi );

	LPTSTR szCmdline2 = _tcsdup(TEXT("Unhidden.exe"));
	CreateProcess(NULL, szCmdline2,  
		NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si,            // Pointer to STARTUPINFO structure
        &pi );

   return 0;
}
Because it is not a "code". It is just a nonsense!