2013-05-05 4 views
2

내 응용 프로그램실행 응용 프로그램은

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) 
{ 
    wprintf(L"SetProcessWindowStation() before: %x\n", GetProcessWindowStation()); 
    HWINSTA winSta = CreateWindowStation(_T("hiddenWinSta"), 0, 0, NULL); 
    if (winSta == NULL) 
    { 
     wprintf(L"CreateWindowStation() failed, error %d!\n", GetLastError()); 
    }else 
     wprintf(L"CreateWindowStation() is OK!\n"); 
    SetProcessWindowStation(winSta); 
    OpenDesktop(L"default", 0, FALSE, READ_CONTROL | WRITE_DAC | DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS); 
    wprintf(L"SetProcessWindowStation() after: %x\n", GetProcessWindowStation()); 
    system("pause"); 
    return 0; 
} 

를 실행하는 새 윈도우 스테이션을 만들 수 없습니다 나는 새 창 역의 스크린 샷이 없습니다 winsta0 및 데스크탑 기본입니다 수 거짓? 저를 도와주세요 :(


출력

SetProcessWindowStation() before: 30 
CreateWindowStation() failed, error 5! 
SetProcessWindowStation() after: 30 
Press any key to continue . . . 
+0

'CreateWindowStation'에 실패 했습니까? 오류 코드가 무엇입니까? – chris

+0

출력이 전에 SetProcessWindowStation() : 012 CreateWindowStation() 실패, 오류 5! SetProcessWindowStation() after : 30 계속하려면 아무 키나 누르십시오. . . –

+1

관리자 권한으로 실행하고 있습니까? 문서를 보면 관리자 만 이름을 지정할 수 있습니다. 그래도 문제를 해결할 수있는 것처럼 보입니다. – chris

답변

4

오류 5 CreateWindowStation에서 ERROR_ACCESS_DENIED

입니다

lpwinsta [in, optional] 
The name of the window station to be created. Window station names are 
case-insensitive and cannot contain backslash characters (\). 
Only members of the Administrators group are allowed to specify a name. 
If lpwinsta is NULL or an empty string, the system forms a window station name 
using the logon session identifier for the calling process. To get this name, 
call the GetUserObjectInformation function. 

그러니 administator로 프로그램을 시작하거나를 지정하지 이름.

관련 문제