日期:2014-05-18  浏览次数:20914 次

Windows Service调用显卡API问题
整个问题简化为:Windows Service调用Nvidia显卡的api时,

C/C++ code

NvAPI_Status status;
NvDisplayHandle hDisplay_a[NVAPI_MAX_PHYSICAL_GPUS * 2] = {0};
NvPhysicalGpuHandle nvGPUHandle;
status = NvAPI_Initialize();
NvPhysicalGpuHandle physicalGPUs[NVAPI_MAX_PHYSICAL_GPUS];  
NvU32 physicalGPUCount;  
status = NvAPI_EnumPhysicalGPUs(physicalGPUs, &physicalGPUCount); 



最后返回的status为NVAPI_NVIDIA_DEVICE_NOT_FOUND,
No NVIDIA display driver, or NVIDIA GPU driving a display, was found.

而在单独application或者dll中调这段代码都能正确返回,
只有windows service里调这段代码返回错误,求解?




------解决方案--------------------
WTSGetActiveConsoleSessionId
SetTokenInformation
CreateProcessAsUser