From 15ae7586591a71045df0f74a3825a6f3797a196c Mon Sep 17 00:00:00 2001 From: Andreas Toth Date: Sat, 9 Jun 2018 00:03:56 +1200 Subject: [PATCH 1/7] Created Visual Studio 2017 project. Tidied up code and converted to UNICODE. Moved and renamed files. Added .gitignores and updated readme.md. --- .gitignore | 329 ++++++++++++++++++++ CreateDesktop.sln | 31 ++ CreateDesktop/.gitignore | 32 ++ CreateDesktop/CreateDesktop.vcxproj | 165 ++++++++++ CreateDesktop/CreateDesktop.vcxproj.filters | 33 ++ CreateDesktop/main.cpp | Bin 0 -> 4296 bytes CreateDesktop/stdafx.h | Bin 0 -> 626 bytes CreateDesktop/targetver.h | Bin 0 -> 626 bytes Main.cpp | 66 ---- README.md | 5 - readme.md | 4 + 11 files changed, 594 insertions(+), 71 deletions(-) create mode 100644 .gitignore create mode 100644 CreateDesktop.sln create mode 100644 CreateDesktop/.gitignore create mode 100644 CreateDesktop/CreateDesktop.vcxproj create mode 100644 CreateDesktop/CreateDesktop.vcxproj.filters create mode 100644 CreateDesktop/main.cpp create mode 100644 CreateDesktop/stdafx.h create mode 100644 CreateDesktop/targetver.h delete mode 100644 Main.cpp delete mode 100644 README.md create mode 100644 readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e9abf7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,329 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ diff --git a/CreateDesktop.sln b/CreateDesktop.sln new file mode 100644 index 0000000..488f745 --- /dev/null +++ b/CreateDesktop.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CreateDesktop", "CreateDesktop\CreateDesktop.vcxproj", "{FBE87476-45CE-4B8F-88FB-1D66142480C8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Debug|x64.ActiveCfg = Debug|x64 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Debug|x64.Build.0 = Debug|x64 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Debug|x86.ActiveCfg = Debug|Win32 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Debug|x86.Build.0 = Debug|Win32 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Release|x64.ActiveCfg = Release|x64 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Release|x64.Build.0 = Release|x64 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Release|x86.ActiveCfg = Release|Win32 + {FBE87476-45CE-4B8F-88FB-1D66142480C8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B72935A8-E3BE-4177-926E-9C21595C2CD2} + EndGlobalSection +EndGlobal diff --git a/CreateDesktop/.gitignore b/CreateDesktop/.gitignore new file mode 100644 index 0000000..259148f --- /dev/null +++ b/CreateDesktop/.gitignore @@ -0,0 +1,32 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/CreateDesktop/CreateDesktop.vcxproj b/CreateDesktop/CreateDesktop.vcxproj new file mode 100644 index 0000000..b0f8c18 --- /dev/null +++ b/CreateDesktop/CreateDesktop.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {FBE87476-45CE-4B8F-88FB-1D66142480C8} + Win32Proj + CreateDesktop + 10.0.17134.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/CreateDesktop/CreateDesktop.vcxproj.filters b/CreateDesktop/CreateDesktop.vcxproj.filters new file mode 100644 index 0000000..89d2ea5 --- /dev/null +++ b/CreateDesktop/CreateDesktop.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/CreateDesktop/main.cpp b/CreateDesktop/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e14317e9dc7851be8621ec9ef9be39210af2c702 GIT binary patch literal 4296 zcmd6qYfl?j5QgXLR_cG)QiZrtOUdV6q=;OIFc{fHv}z)>#ZHVMHu5@wg!0$hKJOVH z?*(?9)ky&XZD@TJ2U?0?;q{%9ADd40ZqK7_SP~xv59Tiv7K|oH}QJ6unX0< z0q?P$**hEB$WmLg+~(Y8_S!D7WX#I#l0Vx;*gdojczzIe74k<& zW@OCBz6(CP3ctyXeIuf9PJE^Tg|wXqEMxn_cI}b<#>zg|1F*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Jz35q;zt9^Q_C^^>*mmuXUCp&pw^fPoGX+dho4RCrySs7j@9_UipWkA5 NQDt4mH~x-^{s1WkYj6Mn literal 0 HcmV?d00001 diff --git a/Main.cpp b/Main.cpp deleted file mode 100644 index e1dc379..0000000 --- a/Main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include - -//Create a new desktop or open an existing one -HDESK CreateHiddenDesktop(CHAR *desktop_name) -{ - CHAR explorer_path[MAX_PATH]; - HDESK hidden_desktop = NULL, original_desktop; - STARTUPINFOA startup_info = {0}; - PROCESS_INFORMATION process_info = {0}; - - ExpandEnvironmentStringsA("%windir%\\explorer.exe", explorer_path, MAX_PATH-1); - - hidden_desktop = OpenDesktopA(desktop_name, NULL, FALSE, GENERIC_ALL); - if(!hidden_desktop) - { - hidden_desktop = CreateDesktopA(desktop_name, NULL, NULL, 0, GENERIC_ALL, NULL); - if(hidden_desktop) - { - original_desktop = GetThreadDesktop(GetCurrentThreadId()); - - if(SetThreadDesktop(hidden_desktop)) - { - startup_info.cb = sizeof(startup_info); - startup_info.lpDesktop = desktop_name; - - //We need to create an explorer.exe in the context of the new desktop for start menu, etc - CreateProcessA(explorer_path, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info); - - SetThreadDesktop(original_desktop); - } - } - } - return hidden_desktop; -} - -void main() -{ - HDESK original_desktop, hidden_desktop; - - hidden_desktop = CreateHiddenDesktop("MalwareTech_Hidden"); - original_desktop = GetThreadDesktop(GetCurrentThreadId()); - - printf("Entering hidden desktop\n"); - - //Need to switch thread into context of new desktop to register hotkeys - SetThreadDesktop(hidden_desktop); - SwitchDesktop(hidden_desktop); - - if(RegisterHotKey(NULL, 1, MOD_CONTROL | MOD_ALT | MOD_NOREPEAT, 0x45)) - { - MSG msg = {0}; - while(GetMessage(&msg, NULL, 0, 0) != 0) - { - if(msg.message == WM_HOTKEY) - { - printf("Exiting hidden desktop\n"); - SwitchDesktop(original_desktop); - break; - } - } - } - - CloseHandle(hidden_desktop); - getchar(); -} \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 5582f67..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# CreateDesktop -**Example application for creating multiple desktops on Windows** - -Creates a new desktop named "MalwareTech_Hidden" and switches into it (You can witch back to the original dekstop with the hotkey CTRL + ALT + E) - diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..0228d6e --- /dev/null +++ b/readme.md @@ -0,0 +1,4 @@ +# CreateDesktop +**Example application for creating a hidden virtual desktop on Windows 10** + +Creates a new virtual desktop named "HiddenDesktop" and switches to it. You can then switch back to the original dekstop with Ctrl + Alt + E. \ No newline at end of file From bd533a89e7c74471ace9ff4e33b499544e4c855c Mon Sep 17 00:00:00 2001 From: Andreas Toth Date: Sat, 9 Jun 2018 00:07:51 +1200 Subject: [PATCH 2/7] Added missing file. Updated readme.md (minor edit). --- CreateDesktop/stdafx.cpp | Bin 0 -> 598 bytes readme.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 CreateDesktop/stdafx.cpp diff --git a/CreateDesktop/stdafx.cpp b/CreateDesktop/stdafx.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5d99289a6e64ab466abe2a2949172c002a83cd9a GIT binary patch literal 598 zcmZ`%!ES;;6r8h3|6!x&>fM{sG`)GygI5#?Ybk3Gqx`%&^EOCn(~!q5yYJ1+o5$lm z!we2*G)R#k#|={)aN^@Ix0`?qYMy2M%HdJku0g^4hG!lXZ%bySygBpa$h{C9qp)m! zCCn2?&G+A`H;kx6T9(Yn3_HWh5WiR*sA$SK5YgdkI!f;LhTrj=toEH*0pHAyYQ-lV zi7Bkna}E0rL^}@9g;SY!b=mjxKTm^}yz)vFIqPdGkyGBV#I2aveeavY_}3H)o^;vK znJw0IWNmYiM>#{Q{1>AfZf#B3sef@MoX*ezO{t}x3)hOZ*=r^a8*It4zz248{PTxf Sae}G{#Eu