- Start a new device manager to test the reactos ATL code.
- Also, the old one sucks big time and was quickly hacked together.
svn path=/trunk/; revision=53648
--- /dev/null
+#include "StdAfx.h"
+#include "Devices.h"
+#include "DeviceView.h"
+
+
+CDeviceView::CDeviceView(void)
+{
+}
+
+
+CDeviceView::~CDeviceView(void)
+{
+}
--- /dev/null
+#pragma once
+class CDeviceView : public CDevices
+{
+public:
+ CDeviceView(void);
+ ~CDeviceView(void);
+};
+
--- /dev/null
+#include "StdAfx.h"
+#include "Devices.h"
+
+
+CDevices::CDevices(void)
+{
+}
+
+
+CDevices::~CDevices(void)
+{
+}
--- /dev/null
+#pragma once
+class CDevices
+{
+public:
+ CDevices(void);
+ ~CDevices(void);
+};
+
--- /dev/null
+#include "StdAfx.h"
+#include "devmgmt.h"
+#include "MainWindow.h"
+
+
+CMainWindow::CMainWindow(void) :
+ m_hMainWnd(NULL),
+ m_CmdShow(0)
+{
+ m_szMainWndClass = L"DevMgmtWndClass";
+}
+
+
+CMainWindow::~CMainWindow(void)
+{
+}
+
+BOOL
+CMainWindow::StatusBarLoadString(IN HWND hStatusBar,
+ IN INT PartId,
+ IN HINSTANCE hInstance,
+ IN UINT uID)
+{
+ CAtlString szMessage;
+ BOOL Ret = FALSE;
+
+ /* Load the string */
+ if (szMessage.LoadStringW(hInstance, uID))
+ {
+ /* Send the message to the status bar */
+ Ret = (BOOL)SendMessageW(hStatusBar,
+ SB_SETTEXT,
+ (WPARAM)PartId,
+ (LPARAM)szMessage.GetBuffer());
+ }
+
+ return Ret;
+}
+
+LRESULT CALLBACK
+CMainWindow::MainWndProc(HWND hwnd,
+ UINT msg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ CMainWindow *pThis;
+ LRESULT Ret = 0;
+
+ /* Get the object pointer from window context */
+ pThis = (CMainWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ /* Check for an invalid pointer */
+ if (!pThis)
+ {
+ /* Check that this isn't a create message */
+ if (msg != WM_CREATE)
+ {
+ /* Don't handle null info pointer */
+ goto HandleDefaultMessage;
+ }
+ }
+
+ switch(msg)
+ {
+ case WM_CREATE:
+ {
+ /* Get the object pointer from the create param */
+ pThis = (CMainWindow *)((LPCREATESTRUCT)lParam)->lpCreateParams;
+
+ /* Store the info pointer in the window's global user data */
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pThis);
+
+ /* Display the window according to the user request */
+ ShowWindow(hwnd, pThis->m_CmdShow);
+
+ break;
+ }
+
+ default:
+ {
+HandleDefaultMessage:
+ Ret = DefWindowProc(hwnd, msg, wParam, lParam);
+ break;
+ }
+ }
+
+ return Ret;
+}
+
+BOOL
+CMainWindow::Initialize(LPCTSTR lpCaption,
+ int nCmdShow)
+{
+ CAtlString szCaption;
+ WNDCLASSEXW wc = {0};
+
+ /* Store the show window value */
+ m_CmdShow = nCmdShow;
+
+ /* Setup the window class struct */
+ wc.cbSize = sizeof(WNDCLASSEXW);
+ wc.lpfnWndProc = MainWndProc;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCEW(IDI_MAIN_ICON));
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+ wc.lpszMenuName = MAKEINTRESOURCEW(IDR_MAINMENU);
+ wc.lpszClassName = m_szMainWndClass;
+ wc.hIconSm = (HICON)LoadImage(g_hInstance,
+ MAKEINTRESOURCE(IDI_MAIN_ICON),
+ IMAGE_ICON,
+ 16,
+ 16,
+ LR_SHARED);
+
+ /* Register the window */
+ if (RegisterClassExW(&wc))
+ {
+ /* Create the main window and store the info pointer */
+ m_hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE,
+ m_szMainWndClass,
+ lpCaption,
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 600,
+ 450,
+ NULL,
+ NULL,
+ g_hInstance,
+ this);
+ }
+
+ /* Return creation result */
+ return !!(m_hMainWnd);
+}
+
+VOID
+CMainWindow::Uninitialize()
+{
+ /* Unregister the window class */
+ UnregisterClassW(m_szMainWndClass, g_hInstance);
+}
+
+INT
+CMainWindow::Run()
+{
+ MSG Msg;
+
+ /* Pump the message queue */
+ while (GetMessageW(&Msg, NULL, 0, 0 ))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessageW(&Msg);
+ }
+
+ return 0;
+}
\ No newline at end of file
--- /dev/null
+#pragma once
+class CMainWindow
+{
+ CAtlString m_szMainWndClass;
+ HWND m_hMainWnd;
+ int m_CmdShow;
+
+private:
+ static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+ BOOL StatusBarLoadString(HWND hStatusBar, INT PartId, HINSTANCE hInstance, UINT uID);
+
+public:
+ CMainWindow(void);
+ ~CMainWindow(void);
+
+ BOOL Initialize(LPCTSTR lpCaption, int nCmdShow);
+ INT Run();
+ VOID Uninitialize();
+};
+
--- /dev/null
+#define IDC_STATIC -1
+
+#define IDI_MAIN_ICON 50
+#define IDB_ROOT_IMAGE 51
+
+/* windows */
+#define IDC_TREEVIEW 1000
+#define IDC_TOOLBAR 1001
+#define IDC_STATUSBAR 1002
+
+/* commands */
+#define IDC_PROP 2000
+#define IDC_REFRESH 2001
+#define IDC_PRINT 2002
+#define IDC_PROGHELP 2003
+#define IDC_EXIT 2004
+#define IDC_ABOUT 4031
+
+/* menus */
+#define IDR_MAINMENU 102
+#define IDR_POPUP 103
+#define IDC_DEVBYTYPE 104
+
+/* tooltips */
+#define IDS_TOOLTIP_PROP 6000
+#define IDS_TOOLTIP_REFRESH 6001
+#define IDS_TOOLTIP_HELP 6002
+#define IDS_TOOLTIP_EXIT 6003
+
+/* button bitmaps */
+#define IDB_PROP 10000
+#define IDB_REFRESH 10001
+#define IDB_HELP 10002
+#define IDB_EXIT 10003
+
+/* toolbar buttons */
+#define TBICON_PROP 0
+#define TBICON_REFRESH 1
+#define TBICON_HELP 2
+#define TBICON_EXIT 3
+
+/* about box info */
+#define IDD_ABOUTBOX 200
+#define IDC_LICENSE_EDIT 201
+#define IDS_APPNAME 202
+#define IDS_LICENSE 203
+
+
+/* menu hints */
+#define IDS_HINT_BLANK 20000
+#define IDS_HINT_REFRESH 20002
+#define IDS_HINT_PROP 20003
+#define IDS_HINT_HELP 20004
+#define IDS_HINT_ABOUT 20005
+#define IDS_HINT_EXIT 20006
+
+/* system menu hints */
+#define IDS_HINT_SYS_RESTORE 21001
+#define IDS_HINT_SYS_MOVE 21002
+#define IDS_HINT_SYS_SIZE 21003
+#define IDS_HINT_SYS_MINIMIZE 21004
+#define IDS_HINT_SYS_MAXIMIZE 21005
+#define IDS_HINT_SYS_CLOSE 21006
+
--- /dev/null
+#include "stdafx.h"
+#include "devmgmt.h"
+#include "MainWindow.h"
+
+HINSTANCE g_hInstance = NULL;
+HANDLE ProcessHeap = NULL;
+
+int WINAPI
+wWinMain(HINSTANCE hThisInstance,
+ HINSTANCE hPrevInstance,
+ LPWSTR lpCmdLine,
+ int nCmdShow)
+{
+ CMainWindow MainWindow;
+ INITCOMMONCONTROLSEX icex;
+ HANDLE hMutex;
+ CAtlString szAppName;
+
+ int Ret = 1;
+
+ /* Check if the app is already running */
+ hMutex = CreateMutexW(NULL, TRUE, L"devmgmt_mutex");
+ if (hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ /* Cleanup and exit */
+ if (hMutex) CloseHandle(hMutex);
+ return 0;
+ }
+
+ /* Store the global values */
+ g_hInstance = hThisInstance;
+ ProcessHeap = GetProcessHeap();
+
+ /* Initialize common controls */
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
+ InitCommonControlsEx(&icex);
+
+ /* Load the application name */
+ if (szAppName.LoadStringW(g_hInstance, IDS_APPNAME))
+ {
+ /* Initialize the main window */
+ if (MainWindow.Initialize(szAppName,
+ nCmdShow))
+ {
+ /* Run the application */
+ Ret = MainWindow.Run();
+
+ /* Uninitialize the main window */
+ MainWindow.Uninitialize();
+ }
+ }
+
+ /* Delete the app mutex */
+ CloseHandle(hMutex);
+
+ return Ret;
+}
--- /dev/null
+#pragma once
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#pragma once
+#include "resource.h"
+
+extern HINSTANCE g_hInstance;
+extern HANDLE ProcessHeap;
+
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devmgmt_new", "devmgmt_new.vcxproj", "{A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}.Debug|Win32.Build.0 = Debug|Win32
+ {A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}.Release|Win32.ActiveCfg = Release|Win32
+ {A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{A5AB2C1A-A085-4A2A-951C-F3CF22DA2890}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>devmgmt_new</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfAtl>Static</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ <UseOfAtl>Static</UseOfAtl>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="Devices.h" />
+ <ClInclude Include="DeviceView.h" />
+ <ClInclude Include="devmgmt.h" />
+ <ClInclude Include="MainWindow.h" />
+ <ClInclude Include="Resource.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h_" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Devices.cpp" />
+ <ClCompile Include="DeviceView.cpp" />
+ <ClCompile Include="devmgmt.cpp" />
+ <ClCompile Include="MainWindow.cpp" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="devmgmt.rc" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+#include <windows.h>
+#include "resource.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+IDI_MAIN_ICON ICON "res/computer.ico"
+IDB_ROOT_IMAGE BITMAP "res/root.bmp"
+
+/* main toolbar icons */
+IDB_PROP BITMAP DISCARDABLE "res/properties.bmp"
+IDB_REFRESH BITMAP DISCARDABLE "res/refresh.bmp"
+IDB_HELP BITMAP DISCARDABLE "res/help.bmp"
+IDB_EXIT BITMAP DISCARDABLE "res/exit.bmp"
+
+#include "lang/bg-BG.rc"
+#include "lang/de-DE.rc"
+#include "lang/el-GR.rc"
+#include "lang/en-US.rc"
+#include "lang/es-ES.rc"
+#include "lang/fr-FR.rc"
+#include "lang/id-ID.rc"
+#include "lang/it-IT.rc"
+#include "lang/ja-JP.rc"
+#include "lang/ko-KR.rc"
+#include "lang/no-NO.rc"
+#include "lang/ro-RO.rc"
+#include "lang/sk-SK.rc"
+#include "lang/sv-SE.rc"
+#include "lang/th-TH.rc"
+
+// UTF-8
+#pragma code_page(65001)
+#include "lang/pl-PL.rc"
+#include "lang/ru-RU.rc"
+#include "lang/uk-UA.rc"
+#include "lang/zh-CN.rc"
--- /dev/null
+#include "stdafx.h"
--- /dev/null
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#include <windowsx.h>
+#include <setupapi.h>
+#include <cfgmgr32.h>
+#include <commctrl.h>
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#include <atlbase.h>
+#include <atlstr.h>