1 #include <windows.h> 2 #include <stdio.h> 3 4 BOOL CALLBACK 5 EnumDesktopProc(LPWSTR lpszWindowStation, LPARAM lParam) 6 { 7 printf("\t%S\n", lpszWindowStation); 8 9 return TRUE; 10 } 11 12 BOOL CALLBACK 13 EnumWindowStationProc(LPWSTR lpszWindowStation, LPARAM lParam) 14 { 15 HWINSTA hWinSta; 16 17 printf("%S\n", lpszWindowStation); 18 hWinSta = OpenWindowStationW(lpszWindowStation, FALSE, 19 WINSTA_ENUMDESKTOPS); 20 if (hWinSta == NULL) 21 { 22 printf("\tCan't open window station.\n"); 23 return TRUE; 24 } 25 EnumDesktopsW(hWinSta, EnumDesktopProc, 0xdede); 26 27 return TRUE; 28 } 29 30 int main() 31 { 32 EnumWindowStationsW(EnumWindowStationProc, 0xbadbed); 33 34 return 0; 35 } 36