ReactOS 0.4.17-dev-806-gffa4164
precomp.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <commctrl.h>
#include <commdlg.h>
#include <tchar.h>
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WM_USER_CLOSE_CHILD   (WM_USER + 1)
 

Functions

BOOL RegisterMMCWndClasses (VOID)
 
VOID UnregisterMMCWndClasses (VOID)
 
HWND CreateConsoleWindow (IN LPCTSTR lpFileName OPTIONAL, int nCmdShow)
 
INT LengthOfStrResource (IN HINSTANCE hInst, IN UINT uID)
 
INT AllocAndLoadString (OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
 
DWORD LoadAndFormatString (IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
 
EXTERN_C BOOL HandleRosMscLaunch (PCWSTR pszCmdLine)
 

Variables

HINSTANCE hAppInstance
 
HANDLE hAppHeap
 
HWND hwndMainConsole
 
HWND hwndMDIClient
 

Macro Definition Documentation

◆ WM_USER_CLOSE_CHILD

#define WM_USER_CLOSE_CHILD   (WM_USER + 1)

Definition at line 14 of file precomp.h.

Function Documentation

◆ AllocAndLoadString()

INT AllocAndLoadString ( OUT LPTSTR lpTarget,
IN HINSTANCE  hInst,
IN UINT  uID 
)

Definition at line 59 of file misc.c.

62{
63 INT ln;
64
66 uID);
67 if (ln++ > 0)
68 {
69 (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED,
70 ln * sizeof(TCHAR));
71 if ((*lpTarget) != NULL)
72 {
73 INT Ret;
74 if (!(Ret = LoadString(hInst, uID, *lpTarget, ln)))
75 {
76 LocalFree((HLOCAL)(*lpTarget));
77 }
78 return Ret;
79 }
80 }
81 return 0;
82}
INT LengthOfStrResource(IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:23
#define NULL
Definition: types.h:112
HINSTANCE hInst
Definition: dxdiag.c:13
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
char TCHAR
Definition: tchar.h:1402
#define LMEM_FIXED
Definition: minwinbase.h:81
_In_ UINT uID
Definition: shlwapi.h:156
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
#define LoadString
Definition: winuser.h:5985

◆ CreateConsoleWindow()

HWND CreateConsoleWindow ( IN LPCTSTR lpFileName  OPTIONAL,
int  nCmdShow 
)

Definition at line 585 of file console.c.

587{
588 HWND hWndConsole;
590
591 hWndConsole = CreateWindowEx(WS_EX_WINDOWEDGE,
593 NULL,
599 NULL,
600 NULL,
602 (PVOID)FileName);
603
604 if (hWndConsole != NULL)
605 {
606 ShowWindow(hWndConsole, nCmdShow);
607 }
608
609 return hWndConsole;
610}
static const TCHAR szMMCMainFrame[]
Definition: console.c:55
HINSTANCE hAppInstance
Definition: mmc.c:23
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define LONG_PTR
Definition: treelist.c:79
_In_ LPCSTR lpFileName
Definition: winbase.h:2800
#define CreateWindowEx
Definition: winuser.h:5921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by _tWinMain().

◆ HandleRosMscLaunch()

EXTERN_C BOOL HandleRosMscLaunch ( PCWSTR  pszCmdLine)

Definition at line 124 of file mscfile.c.

125{
126 BOOL result = FALSE;
127 IXMLDOMNode *pRoot;
128 HRESULT hrCom = CoInitialize(NULL);
129
130 int argc;
131 LPWSTR *argv = CommandLineToArgvW(pszCmdLine, &argc);
132 if (argv && argc > 0)
133 {
134 if (SUCCEEDED(GetMscRootNode(argv[0], &pRoot)))
135 {
136 IXMLDOMNode *pNode;
137 HRESULT hr = xmldomunk_getelembytag((IUnknown*)pRoot, L"RosLaunch", 0, &pNode);
138 IUnknown_Release(pRoot);
139 if (SUCCEEDED(hr))
140 {
142 SHELLEXECUTEINFOW sei = { sizeof(sei), flags, NULL, NULL, NULL, NULL, NULL, SW_SHOW };
143 if (SUCCEEDED(xmldomnode_getattributevalue(pNode, L"File", (BSTR*)&sei.lpFile)))
144 {
145 xmldomnode_getattributevalue(pNode, L"Parameters", (BSTR*)&sei.lpParameters);
146 result = sei.lpFile && *sei.lpFile && ShellExecuteExW(&sei);
149 }
150 IUnknown_Release(pNode);
151 }
152 }
154 }
155
156 if (SUCCEEDED(hrCom))
158 return result;
159}
HRESULT hr
Definition: delayimp.cpp:582
#define FALSE
Definition: types.h:117
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
OLECHAR * BSTR
Definition: compat.h:2293
MonoAssembly int argc
Definition: metahost.c:107
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
WCHAR **WINAPI CommandLineToArgvW(const WCHAR *cmdline, int *numargs)
Definition: main.c:294
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
unsigned int UINT
Definition: sysinfo.c:13
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define argv
Definition: mplay32.c:18
static HRESULT xmldomunk_getelembytag(IUnknown *punk, LPCWSTR name, long index, IXMLDOMNode **ppout)
Definition: mscfile.c:58
static HRESULT xmldomnode_getattributevalue(IXMLDOMNode *pnode, LPCWSTR name, BSTR *pout)
Definition: mscfile.c:16
static HRESULT GetMscRootNode(PCWSTR pszFilePath, IXMLDOMNode **ppRoot)
Definition: mscfile.c:88
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
#define SEE_MASK_DOENVSUBST
Definition: shellapi.h:37
#define SEE_MASK_FLAG_DDEWAIT
Definition: shellapi.h:36
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:38
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2732
LPCWSTR lpParameters
Definition: shellapi.h:339
#define SW_SHOW
Definition: winuser.h:786

Referenced by _tWinMain().

◆ LengthOfStrResource()

INT LengthOfStrResource ( IN HINSTANCE  hInst,
IN UINT  uID 
)

Definition at line 23 of file misc.c.

25{
26 HRSRC hrSrc;
27 HGLOBAL hRes;
28 LPWSTR lpName, lpStr;
29
30 if (hInst == NULL)
31 {
32 return -1;
33 }
34
35 /* There are always blocks of 16 strings */
36 lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
37
38 /* Find the string table block */
39 if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
40 (hRes = LoadResource(hInst, hrSrc)) &&
41 (lpStr = LockResource(hRes)))
42 {
43 UINT x;
44
45 /* Find the string we're looking for */
46 uID &= 0xF; /* position in the block, same as % 16 */
47 for (x = 0; x < uID; x++)
48 {
49 lpStr += (*lpStr) + 1;
50 }
51
52 /* Found the string */
53 return (int)(*lpStr);
54 }
55 return -1;
56}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define RT_STRING
Definition: pedump.c:368
_In_ LPCSTR lpName
Definition: winbase.h:2519

◆ LoadAndFormatString()

DWORD LoadAndFormatString ( IN HINSTANCE  hInstance,
IN UINT  uID,
OUT LPTSTR lpTarget,
  ... 
)

Definition at line 85 of file misc.c.

89{
90 DWORD Ret = 0;
92 va_list lArgs;
93
96 uID) != 0)
97 {
98 va_start(lArgs, lpTarget);
99 /* let's use FormatMessage to format it because it has the ability to allocate
100 memory automatically */
102 lpFormat,
103 0,
104 0,
105 (LPTSTR)lpTarget,
106 0,
107 &lArgs);
108 va_end(lArgs);
109
111 }
112
113 return Ret;
114}
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
HINSTANCE hInstance
Definition: charmap.c:19
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR LPTSTR
Definition: ms-dtyp.idl:131
LPCWSTR lpFormat
Definition: trayclock.cpp:32
#define FormatMessage
Definition: winbase.h:3516
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396

◆ RegisterMMCWndClasses()

BOOL RegisterMMCWndClasses ( VOID  )

Definition at line 526 of file console.c.

527{
528 WNDCLASSEX wc = {0};
529 BOOL Ret;
530
531 /* Register the MMCMainFrame window class */
532 wc.cbSize = sizeof(WNDCLASSEX);
533 wc.style = 0;
535 wc.cbClsExtra = 0;
542 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
543 wc.lpszMenuName = NULL;
545
546 Ret = (RegisterClassEx(&wc) != (ATOM)0);
547
548 if (Ret)
549 {
550 /* Register the MMCChildFrm window class */
551 wc.cbSize = sizeof(WNDCLASSEX);
554 wc.cbClsExtra = 0;
559 wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
560 wc.lpszMenuName = NULL;
563
564 Ret = (RegisterClassEx(&wc) != (ATOM)0);
565 if (!Ret)
566 {
569 }
570 }
571
572 return Ret;
573}
static LRESULT CALLBACK ConsoleChildFrmProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:479
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
static const TCHAR szMMCChildFrm[]
Definition: console.c:56
static LRESULT CALLBACK ConsoleMainFrameWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:398
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
#define IDI_MAINAPP
Definition: resource.h:6
WORD ATOM
Definition: dimm.idl:113
int cbClsExtra
Definition: winuser.h:3312
HINSTANCE hInstance
Definition: winuser.h:3314
HCURSOR hCursor
Definition: winuser.h:3316
LPCSTR lpszMenuName
Definition: winuser.h:3318
HICON hIconSm
Definition: winuser.h:3320
UINT style
Definition: winuser.h:3310
int cbWndExtra
Definition: winuser.h:3313
UINT cbSize
Definition: winuser.h:3309
WNDPROC lpfnWndProc
Definition: winuser.h:3311
LPCSTR lpszClassName
Definition: winuser.h:3319
HICON hIcon
Definition: winuser.h:3315
HBRUSH hbrBackground
Definition: winuser.h:3317
#define CS_VREDRAW
Definition: winuser.h:666
#define CS_HREDRAW
Definition: winuser.h:661
#define IDC_ARROW
Definition: winuser.h:695
#define UnregisterClass
Definition: winuser.h:6027
#define IDI_APPLICATION
Definition: winuser.h:712
#define RegisterClassEx
Definition: winuser.h:6003
#define LoadIcon
Definition: winuser.h:5979
#define LoadCursor
Definition: winuser.h:5978
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5885
#define COLOR_BTNFACE
Definition: winuser.h:939
#define COLOR_3DFACE
Definition: winuser.h:940

Referenced by _tWinMain().

◆ UnregisterMMCWndClasses()

VOID UnregisterMMCWndClasses ( VOID  )

Definition at line 576 of file console.c.

Referenced by _tWinMain().

Variable Documentation

◆ hAppHeap

HANDLE hAppHeap
extern

Definition at line 24 of file mmc.c.

◆ hAppInstance

HINSTANCE hAppInstance
extern

Definition at line 23 of file mmc.c.

◆ hwndMainConsole

HWND hwndMainConsole
extern

Definition at line 25 of file mmc.c.

Referenced by _tWinMain(), and ConsoleChildFrmProc().

◆ hwndMDIClient