diff options
author | Oliver Schneider <oliver@assarbad.net> | 2014-01-31 06:06:08 +0400 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2014-01-31 06:06:08 +0400 |
commit | a4f47f8fad7d02b961c655cc0495f7ecc8c82a78 (patch) | |
tree | 892f93bed099f62cfaa61f13d331dc3cd980a0f0 | |
parent | a2d7867c99f4df9868f136b73162a1d43c27ece0 (diff) |
Adding functions that will allow us to be more specific about the elevation event
--HG--
branch : elevation
-rw-r--r-- | windirstat/osspecific.cpp | 42 | ||||
-rw-r--r-- | windirstat/osspecific.h | 2 |
2 files changed, 43 insertions, 1 deletions
diff --git a/windirstat/osspecific.cpp b/windirstat/osspecific.cpp index cec839d..a368467 100644 --- a/windirstat/osspecific.cpp +++ b/windirstat/osspecific.cpp @@ -58,5 +58,45 @@ BOOL FileIconInit(__in BOOL fRestoreCache) { return pfnFileIconInit(fRestoreCache); } - return TRUE; + return FALSE; } + +CString GetCurrentDesktopName()
+{
+ if(HDESK hDesktop = ::GetThreadDesktop(::GetCurrentThreadId()))
+ {
+ DWORD dwNeeded = 0;
+ if(!::GetUserObjectInformation(hDesktop, UOI_NAME, NULL, 0, &dwNeeded) && dwNeeded)
+ {
+ CString retval;
+ dwNeeded /= sizeof(TCHAR) + 1;
+ LPTSTR buf = retval.GetBuffer(dwNeeded);
+ if(::GetUserObjectInformation(hDesktop, UOI_NAME, buf, dwNeeded, &dwNeeded))
+ {
+ retval.ReleaseBuffer();
+ return retval;
+ }
+ }
+ }
+ return CString();
+}
+
+CString GetCurrentWinstaName()
+{
+ if(HWINSTA hWinsta = GetProcessWindowStation())
+ {
+ DWORD dwNeeded = 0;
+ if(!GetUserObjectInformation(hWinsta, UOI_NAME, NULL, 0, &dwNeeded) && dwNeeded)
+ {
+ CString retval;
+ dwNeeded /= sizeof(TCHAR) + 1;
+ LPTSTR buf = retval.GetBuffer(dwNeeded);
+ if(GetUserObjectInformation(hWinsta, UOI_NAME, buf, dwNeeded, &dwNeeded))
+ {
+ retval.ReleaseBuffer();
+ return retval;
+ }
+ }
+ }
+ return CString();
+}
diff --git a/windirstat/osspecific.h b/windirstat/osspecific.h index f4d7886..8e09fc4 100644 --- a/windirstat/osspecific.h +++ b/windirstat/osspecific.h @@ -30,6 +30,8 @@ #include <ShellAPI.h> BOOL FileIconInit(__in BOOL fRestoreCache); +CString GetCurrentDesktopName(); +CString GetCurrentWinstaName(); class CAbstractionLayer { |