Sync with trunk r63887.
authorDavid Quintana <gigaherz@gmail.com>
Thu, 14 Aug 2014 23:55:08 +0000 (23:55 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Thu, 14 Aug 2014 23:55:08 +0000 (23:55 +0000)
svn path=/branches/shell-experiments/; revision=63888

34 files changed:
dll/cpl/console/console.c
dll/cpl/console/layout.c
dll/win32/kernel32/client/console/console.c
dll/win32/shell32/defcontextmenu.cpp
dll/win32/shell32/shlview.cpp
drivers/filesystems/npfs/waitsup.c
include/psdk/shobjidl.idl
win32ss/user/ntuser/misc.c
win32ss/user/winsrv/consrv/alias.c
win32ss/user/winsrv/consrv/alias.h
win32ss/user/winsrv/consrv/condrv/console.c
win32ss/user/winsrv/consrv/coninput.c
win32ss/user/winsrv/consrv/conoutput.c
win32ss/user/winsrv/consrv/console.c
win32ss/user/winsrv/consrv/consrv.h
win32ss/user/winsrv/consrv/frontendctl.c
win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
win32ss/user/winsrv/consrv/frontends/gui/fullscreen.c
win32ss/user/winsrv/consrv/frontends/gui/graphics.c
win32ss/user/winsrv/consrv/frontends/gui/guisettings.c
win32ss/user/winsrv/consrv/frontends/gui/guisettings.h
win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
win32ss/user/winsrv/consrv/frontends/gui/guiterm.h
win32ss/user/winsrv/consrv/frontends/gui/text.c
win32ss/user/winsrv/consrv/frontends/input.c
win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
win32ss/user/winsrv/consrv/frontends/tui/tuiterm.h
win32ss/user/winsrv/consrv/handle.c
win32ss/user/winsrv/consrv/include/conio.h
win32ss/user/winsrv/consrv/include/conio_winsrv.h
win32ss/user/winsrv/consrv/lineinput.c
win32ss/user/winsrv/consrv/lineinput.h
win32ss/user/winsrv/consrv/subsysreg.c

index 436626b..8fdda90 100644 (file)
@@ -117,7 +117,8 @@ InitConsoleDefaults(PCONSOLE_PROPS pConInfo)
     GuiInfo->FontFamily = FF_DONTCARE;
     GuiInfo->FontSize.X = 0;
     GuiInfo->FontSize.Y = 0;
     GuiInfo->FontFamily = FF_DONTCARE;
     GuiInfo->FontSize.X = 0;
     GuiInfo->FontSize.Y = 0;
-    GuiInfo->FontWeight = FW_DONTCARE;
+    GuiInfo->FontWeight = FW_NORMAL; // HACK: !!
+    // GuiInfo->FontWeight = FW_DONTCARE;
 
     GuiInfo->FullScreen   = FALSE;
     GuiInfo->ShowWindow   = SW_SHOWNORMAL;
 
     GuiInfo->FullScreen   = FALSE;
     GuiInfo->ShowWindow   = SW_SHOWNORMAL;
index fac40bb..90926c8 100644 (file)
@@ -121,7 +121,7 @@ PaintText(LPDRAWITEMSTRUCT drawItem,
     if (!hBrush) return FALSE;
 
     Font = CreateFontW(GuiInfo->FontSize.Y,
     if (!hBrush) return FALSE;
 
     Font = CreateFontW(GuiInfo->FontSize.Y,
-                       0, // GuiInfo->FontSize.X,
+                       GuiInfo->FontSize.X,
                        0,
                        TA_BASELINE,
                        GuiInfo->FontWeight,
                        0,
                        TA_BASELINE,
                        GuiInfo->FontWeight,
@@ -131,8 +131,8 @@ PaintText(LPDRAWITEMSTRUCT drawItem,
                        OEM_CHARSET,
                        OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS,
                        OEM_CHARSET,
                        OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS,
-                       NONANTIALIASED_QUALITY,
-                       FIXED_PITCH | GuiInfo->FontFamily /* FF_DONTCARE */,
+                       DEFAULT_QUALITY, // NONANTIALIASED_QUALITY ; ANTIALIASED_QUALITY
+                       FIXED_PITCH | GuiInfo->FontFamily,
                        GuiInfo->FaceName);
     if (Font == NULL)
     {
                        GuiInfo->FaceName);
     if (Font == NULL)
     {
index fe4a084..0a4059a 100644 (file)
@@ -561,7 +561,7 @@ InvalidateConsoleDIBits(IN HANDLE hConsoleOutput,
 
 
 /*
 
 
 /*
- * @unimplemented (Undocumented)
+ * @implemented (Undocumented)
  */
 HANDLE
 WINAPI
  */
 HANDLE
 WINAPI
index f7717a1..6d8bda3 100644 (file)
@@ -37,9 +37,11 @@ class CDefaultContextMenu :
     public IContextMenu2
 {
     private:
     public IContextMenu2
 {
     private:
-        DEFCONTEXTMENU m_Dcm;
+        IShellFolder *m_psf;
+        UINT m_cidl;
+        PCUITEMID_CHILD_ARRAY m_apidl;
         IDataObject *m_pDataObj;
         IDataObject *m_pDataObj;
-        LPCITEMIDLIST m_pidlFolder;
+        PIDLIST_ABSOLUTE m_pidlFolder;
         DWORD m_bGroupPolicyActive;
         PDynamicShellEntry m_pDynamicEntries; /* first dynamic shell extension entry */
         UINT m_iIdSHEFirst; /* first used id */
         DWORD m_bGroupPolicyActive;
         PDynamicShellEntry m_pDynamicEntries; /* first dynamic shell extension entry */
         UINT m_iIdSHEFirst; /* first used id */
@@ -92,18 +94,20 @@ class CDefaultContextMenu :
         END_COM_MAP()
 };
 
         END_COM_MAP()
 };
 
-CDefaultContextMenu::CDefaultContextMenu()
+CDefaultContextMenu::CDefaultContextMenu() :
+    m_psf(NULL),
+    m_cidl(0),
+    m_apidl(NULL),
+    m_pDataObj(NULL),
+    m_pidlFolder(NULL),
+    m_bGroupPolicyActive(0),
+    m_pDynamicEntries(NULL),
+    m_iIdSHEFirst(0),
+    m_iIdSHELast(0),
+    m_pStaticEntries(NULL),
+    m_iIdSCMFirst(0),
+    m_iIdSCMLast(0)
 {
 {
-    memset(&m_Dcm, 0, sizeof(m_Dcm));
-    m_pDataObj = NULL;
-    m_pidlFolder = NULL;
-    m_bGroupPolicyActive = 0;
-    m_pDynamicEntries = NULL;
-    m_iIdSHEFirst = 0;
-    m_iIdSHELast = 0;
-    m_pStaticEntries = NULL;
-    m_iIdSCMFirst = 0;
-    m_iIdSCMLast = 0;
 }
 
 CDefaultContextMenu::~CDefaultContextMenu()
 }
 
 CDefaultContextMenu::~CDefaultContextMenu()
@@ -130,9 +134,12 @@ CDefaultContextMenu::~CDefaultContextMenu()
     }
 
     if (m_pidlFolder)
     }
 
     if (m_pidlFolder)
-        ILFree((_ITEMIDLIST*)m_pidlFolder);
+        CoTaskMemFree(m_pidlFolder);
     if (m_pDataObj)
         m_pDataObj->Release();
     if (m_pDataObj)
         m_pDataObj->Release();
+    _ILFreeaPidl(const_cast<PITEMID_CHILD *>(m_apidl), m_cidl);
+    if (m_psf)
+        m_psf->Release();
 }
 
 HRESULT WINAPI CDefaultContextMenu::Initialize(const DEFCONTEXTMENU *pdcm)
 }
 
 HRESULT WINAPI CDefaultContextMenu::Initialize(const DEFCONTEXTMENU *pdcm)
@@ -140,28 +147,33 @@ HRESULT WINAPI CDefaultContextMenu::Initialize(const DEFCONTEXTMENU *pdcm)
     IDataObject *pDataObj;
 
     TRACE("cidl %u\n", pdcm->cidl);
     IDataObject *pDataObj;
 
     TRACE("cidl %u\n", pdcm->cidl);
+
+    m_cidl = pdcm->cidl;
+    m_apidl = const_cast<PCUITEMID_CHILD_ARRAY>(_ILCopyaPidl(pdcm->apidl, m_cidl));
+    if (m_cidl && !m_apidl)
+        return E_OUTOFMEMORY;
+    m_psf = pdcm->psf;
+    m_psf->AddRef();
+
     if (SUCCEEDED(SHCreateDataObject(pdcm->pidlFolder, pdcm->cidl, pdcm->apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
         m_pDataObj = pDataObj;
 
     if (SUCCEEDED(SHCreateDataObject(pdcm->pidlFolder, pdcm->cidl, pdcm->apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
         m_pDataObj = pDataObj;
 
-    if (!pdcm->cidl)
+    if (pdcm->pidlFolder)
     {
     {
-        /* Init pidlFolder only if it is background context menu. See IShellExtInit::Initialize */
-        if (pdcm->pidlFolder)
-            m_pidlFolder = ILClone(pdcm->pidlFolder);
-        else
+        m_pidlFolder = ILClone(pdcm->pidlFolder);
+    }
+    else
+    {
+        IPersistFolder2 *pf = NULL;
+        if (SUCCEEDED(m_psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &pf))))
         {
         {
-            IPersistFolder2 *pf = NULL;
-            if (SUCCEEDED(pdcm->psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &pf))))
-            {
-                if (FAILED(pf->GetCurFolder((_ITEMIDLIST**)&m_pidlFolder)))
-                    ERR("GetCurFolder failed\n");
-                pf->Release();
-            }
+            if (FAILED(pf->GetCurFolder(reinterpret_cast<LPITEMIDLIST*>(&m_pidlFolder))))
+                ERR("GetCurFolder failed\n");
+            pf->Release();
         }
         TRACE("pidlFolder %p\n", m_pidlFolder);
     }
 
         }
         TRACE("pidlFolder %p\n", m_pidlFolder);
     }
 
-    CopyMemory(&m_Dcm, pdcm, sizeof(DEFCONTEXTMENU));
     return S_OK;
 }
 
     return S_OK;
 }
 
@@ -603,7 +615,7 @@ CDefaultContextMenu::AddStaticContextMenusToMenu(
         /* set first entry as default */
         if (pEntry == m_pStaticEntries)
             fState |= MFS_DEFAULT;
         /* set first entry as default */
         if (pEntry == m_pStaticEntries)
             fState |= MFS_DEFAULT;
-        
+
         if (!wcsicmp(pEntry->szVerb, L"open"))
         {
             /* override default when open verb is found */
         if (!wcsicmp(pEntry->szVerb, L"open"))
         {
             /* override default when open verb is found */
@@ -714,14 +726,14 @@ CDefaultContextMenu::BuildShellItemContextMenu(
     HRESULT hr;
 
     TRACE("BuildShellItemContextMenu entered\n");
     HRESULT hr;
 
     TRACE("BuildShellItemContextMenu entered\n");
-    ASSERT(m_Dcm.cidl >= 1);
+    ASSERT(m_cidl >= 1);
 
     STRRET strFile;
 
     STRRET strFile;
-    hr = m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strFile);
+    hr = m_psf->GetDisplayNameOf(m_apidl[0], SHGDN_FORPARSING, &strFile);
     if (hr == S_OK)
     {
         WCHAR wszPath[MAX_PATH];
     if (hr == S_OK)
     {
         WCHAR wszPath[MAX_PATH];
-        hr = StrRetToBufW(&strFile, m_Dcm.apidl[0], wszPath, _countof(wszPath));
+        hr = StrRetToBufW(&strFile, m_apidl[0], wszPath, _countof(wszPath));
         if (hr == S_OK)
         {
             LPCWSTR pwszExt = PathFindExtensionW(wszPath);
         if (hr == S_OK)
         {
             LPCWSTR pwszExt = PathFindExtensionW(wszPath);
@@ -765,7 +777,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
     else
         ERR("GetDisplayNameOf failed: %x\n", hr);
 
     else
         ERR("GetDisplayNameOf failed: %x\n", hr);
 
-    GUID *pGuid = _ILGetGUIDPointer(m_Dcm.apidl[0]);
+    GUID *pGuid = _ILGetGUIDPointer(m_apidl[0]);
     if (pGuid)
     {
         LPOLESTR pwszCLSID;
     if (pGuid)
     {
         LPOLESTR pwszCLSID;
@@ -787,7 +799,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
         }
     }
 
         }
     }
 
-    if (_ILIsDrive(m_Dcm.apidl[0]))
+    if (_ILIsDrive(m_apidl[0]))
     {
         AddStaticEntryForFileClass(L"Drive");
         if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Drive", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
     {
         AddStaticEntryForFileClass(L"Drive");
         if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Drive", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
@@ -800,7 +812,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
 
     /* add static actions */
     SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
 
     /* add static actions */
     SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
-    hr = m_Dcm.psf->GetAttributesOf(m_Dcm.cidl, m_Dcm.apidl, &rfg);
+    hr = m_psf->GetAttributesOf(m_cidl, m_apidl, &rfg);
     if (FAILED(hr))
     {
         ERR("GetAttributesOf failed: %x\n", hr);
     if (FAILED(hr))
     {
         ERR("GetAttributesOf failed: %x\n", hr);
@@ -818,7 +830,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
         }
 
         /* Directory is only loaded for real filesystem directories */
         }
 
         /* Directory is only loaded for real filesystem directories */
-        if (_ILIsFolder(m_Dcm.apidl[0]))
+        if (_ILIsFolder(m_apidl[0]))
         {
             AddStaticEntryForFileClass(L"Directory");
             if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
         {
             AddStaticEntryForFileClass(L"Directory");
             if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
@@ -830,7 +842,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
     }
 
     /* AllFilesystemObjects class is loaded only for files and directories */
     }
 
     /* AllFilesystemObjects class is loaded only for files and directories */
-    if (_ILIsFolder(m_Dcm.apidl[0]) || _ILIsValue(m_Dcm.apidl[0]))
+    if (_ILIsFolder(m_apidl[0]) || _ILIsValue(m_apidl[0]))
     {
         if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
         {
     {
         if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
         {
@@ -848,7 +860,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
     IndexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, IndexMenu, iIdCmdFirst, iIdCmdLast);
     TRACE("IndexMenu %d\n", IndexMenu);
 
     IndexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, IndexMenu, iIdCmdFirst, iIdCmdLast);
     TRACE("IndexMenu %d\n", IndexMenu);
 
-    if (_ILIsDrive(m_Dcm.apidl[0]))
+    if (_ILIsDrive(m_apidl[0]))
     {
         /* The 'Format' option must be always available,
          * thus it is not registered as a static shell extension */
     {
         /* The 'Format' option must be always available,
          * thus it is not registered as a static shell extension */
@@ -916,7 +928,7 @@ CDefaultContextMenu::QueryContextMenu(
     UINT idCmdLast,
     UINT uFlags)
 {
     UINT idCmdLast,
     UINT uFlags)
 {
-    if (m_Dcm.cidl)
+    if (m_cidl)
         idCmdFirst = BuildShellItemContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags);
     else
         idCmdFirst = BuildBackgroundContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags);
         idCmdFirst = BuildShellItemContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags);
     else
         idCmdFirst = BuildBackgroundContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags);
@@ -951,7 +963,7 @@ CDefaultContextMenu::DoRefresh(
 {
     CComPtr<IPersistFolder2> ppf2 = NULL;
     LPITEMIDLIST pidl;
 {
     CComPtr<IPersistFolder2> ppf2 = NULL;
     LPITEMIDLIST pidl;
-    HRESULT hr = m_Dcm.psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
+    HRESULT hr = m_psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
     if (SUCCEEDED(hr))
     {
         hr = ppf2->GetCurFolder(&pidl);
     if (SUCCEEDED(hr))
     {
         hr = ppf2->GetCurFolder(&pidl);
@@ -984,9 +996,9 @@ CDefaultContextMenu::DoPaste(
         return hr;
 
     /* Find target folder */
         return hr;
 
     /* Find target folder */
-    if (m_Dcm.cidl)
+    if (m_cidl)
     {
     {
-        hr = m_Dcm.psf->BindToObject(m_Dcm.apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfTarget));
+        hr = m_psf->BindToObject(m_apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfTarget));
     }
     else
     {
     }
     else
     {
@@ -994,7 +1006,7 @@ CDefaultContextMenu::DoPaste(
         LPITEMIDLIST pidl;
 
         /* cidl is zero due to explorer view */
         LPITEMIDLIST pidl;
 
         /* cidl is zero due to explorer view */
-        hr = m_Dcm.psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
+        hr = m_psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
         if (SUCCEEDED(hr))
         {
             hr = ppf2->GetCurFolder(&pidl);
         if (SUCCEEDED(hr))
         {
             hr = ppf2->GetCurFolder(&pidl);
@@ -1087,9 +1099,9 @@ CDefaultContextMenu::DoCreateLink(
     if (FAILED(hr))
         return hr;
 
     if (FAILED(hr))
         return hr;
 
-    if (SUCCEEDED(hr = SHCreateDataObject(m_Dcm.pidlFolder, m_Dcm.cidl, m_Dcm.apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
+    if (SUCCEEDED(hr = SHCreateDataObject(m_pidlFolder, m_cidl, m_apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
     {
     {
-        hr = m_Dcm.psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
+        hr = m_psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
         if (SUCCEEDED(hr))
         {
             hr = ppf2->GetCurFolder(&pidl);
         if (SUCCEEDED(hr))
         {
             hr = ppf2->GetCurFolder(&pidl);
@@ -1134,13 +1146,13 @@ HRESULT CDefaultContextMenu::DoDelete(LPCMINVOKECOMMANDINFO lpcmi) {
 
     LPDATAOBJECT pDataObj;
 
 
     LPDATAOBJECT pDataObj;
 
-    if (SUCCEEDED(SHCreateDataObject(m_Dcm.pidlFolder, m_Dcm.cidl, m_Dcm.apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
+    if (SUCCEEDED(SHCreateDataObject(m_pidlFolder, m_cidl, m_apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
     {
         pDataObj->AddRef();
         SHCreateThread(DoDeleteThreadProc, pDataObj, NULL, NULL);
         pDataObj->Release();
     {
         pDataObj->AddRef();
         SHCreateThread(DoDeleteThreadProc, pDataObj, NULL, NULL);
         pDataObj->Release();
-    } 
-    else 
+    }
+    else
         return E_FAIL;
     return S_OK;
 
         return E_FAIL;
     return S_OK;
 
@@ -1154,7 +1166,7 @@ CDefaultContextMenu::DoCopyOrCut(
     LPDATAOBJECT pDataObj;
     HRESULT hr;
 
     LPDATAOBJECT pDataObj;
     HRESULT hr;
 
-    if (SUCCEEDED(SHCreateDataObject(m_Dcm.pidlFolder, m_Dcm.cidl, m_Dcm.apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
+    if (SUCCEEDED(SHCreateDataObject(m_pidlFolder, m_cidl, m_apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj))))
     {
         if (!bCopy)
         {
     {
         if (!bCopy)
         {
@@ -1233,7 +1245,7 @@ CDefaultContextMenu::DoRename(
         return hr;
     }
 
         return hr;
     }
 
-    lpSV->SelectItem(m_Dcm.apidl[0],
+    lpSV->SelectItem(m_apidl[0],
                      SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT);
     lpSV->Release();
     return S_OK;
                      SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT);
     lpSV->Release();
     return S_OK;
@@ -1244,26 +1256,26 @@ CDefaultContextMenu::DoProperties(
     LPCMINVOKECOMMANDINFO lpcmi)
 {
     HRESULT hr = S_OK;
     LPCMINVOKECOMMANDINFO lpcmi)
 {
     HRESULT hr = S_OK;
-    const ITEMIDLIST *pidlParent = m_Dcm.pidlFolder, *pidlChild;
+    const ITEMIDLIST *pidlParent = m_pidlFolder, *pidlChild;
 
     if (!pidlParent)
     {
         IPersistFolder2 *pf;
 
         /* pidlFolder is optional */
 
     if (!pidlParent)
     {
         IPersistFolder2 *pf;
 
         /* pidlFolder is optional */
-        if (SUCCEEDED(m_Dcm.psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &pf))))
+        if (SUCCEEDED(m_psf->QueryInterface(IID_PPV_ARG(IPersistFolder2, &pf))))
         {
             pf->GetCurFolder((_ITEMIDLIST**)&pidlParent);
             pf->Release();
         }
     }
 
         {
             pf->GetCurFolder((_ITEMIDLIST**)&pidlParent);
             pf->Release();
         }
     }
 
-    if (m_Dcm.cidl > 0)
-        pidlChild = m_Dcm.apidl[0];
+    if (m_cidl > 0)
+        pidlChild = m_apidl[0];
     else
     {
         /* Set pidlChild to last pidl of current folder */
     else
     {
         /* Set pidlChild to last pidl of current folder */
-        if (pidlParent == m_Dcm.pidlFolder)
+        if (pidlParent == m_pidlFolder)
             pidlParent = (ITEMIDLIST*)ILClone(pidlParent);
 
         pidlChild = (ITEMIDLIST*)ILClone(ILFindLastID(pidlParent));
             pidlParent = (ITEMIDLIST*)ILClone(pidlParent);
 
         pidlChild = (ITEMIDLIST*)ILClone(ILFindLastID(pidlParent));
@@ -1303,11 +1315,11 @@ CDefaultContextMenu::DoProperties(
     }
     else
     {
     }
     else
     {
-        if (m_Dcm.cidl > 1)
+        if (m_cidl > 1)
             WARN("SHMultiFileProperties is not yet implemented\n");
 
         STRRET strFile;
             WARN("SHMultiFileProperties is not yet implemented\n");
 
         STRRET strFile;
-        hr = m_Dcm.psf->GetDisplayNameOf(pidlChild, SHGDN_FORPARSING, &strFile);
+        hr = m_psf->GetDisplayNameOf(pidlChild, SHGDN_FORPARSING, &strFile);
         if (SUCCEEDED(hr))
         {
             WCHAR wszBuf[MAX_PATH];
         if (SUCCEEDED(hr))
         {
             WCHAR wszBuf[MAX_PATH];
@@ -1322,9 +1334,9 @@ CDefaultContextMenu::DoProperties(
     }
 
     /* Free allocated PIDLs */
     }
 
     /* Free allocated PIDLs */
-    if (pidlParent != m_Dcm.pidlFolder)
+    if (pidlParent != m_pidlFolder)
         ILFree((ITEMIDLIST*)pidlParent);
         ILFree((ITEMIDLIST*)pidlParent);
-    if (m_Dcm.cidl < 1 || pidlChild != m_Dcm.apidl[0])
+    if (m_cidl < 1 || pidlChild != m_apidl[0])
         ILFree((ITEMIDLIST*)pidlChild);
 
     return hr;
         ILFree((ITEMIDLIST*)pidlChild);
 
     return hr;
@@ -1336,7 +1348,7 @@ CDefaultContextMenu::DoFormat(
 {
     char szDrive[8] = {0};
 
 {
     char szDrive[8] = {0};
 
-    if (!_ILGetDrive(m_Dcm.apidl[0], szDrive, sizeof(szDrive)))
+    if (!_ILGetDrive(m_apidl[0], szDrive, sizeof(szDrive)))
     {
         ERR("pidl is not a drive\n");
         return E_FAIL;
     {
         ERR("pidl is not a drive\n");
         return E_FAIL;
@@ -1417,7 +1429,7 @@ CDefaultContextMenu::TryToBrowse(
     if (lpSB == NULL)
         return E_FAIL;
 
     if (lpSB == NULL)
         return E_FAIL;
 
-    hr = lpSB->BrowseObject(ILCombine(m_Dcm.pidlFolder, pidl), wFlags);
+    hr = lpSB->BrowseObject(ILCombine(m_pidlFolder, pidl), wFlags);
 
     return hr;
 }
 
     return hr;
 }
@@ -1425,7 +1437,7 @@ CDefaultContextMenu::TryToBrowse(
 HRESULT
 CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFO lpcmi, LPCITEMIDLIST pidl, PStaticShellEntry pEntry)
 {
 HRESULT
 CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFO lpcmi, LPCITEMIDLIST pidl, PStaticShellEntry pEntry)
 {
-    LPITEMIDLIST pidlFull = ILCombine(m_Dcm.pidlFolder, pidl);
+    LPITEMIDLIST pidlFull = ILCombine(m_pidlFolder, pidl);
     if (pidlFull == NULL)
     {
         return E_FAIL;
     if (pidlFull == NULL)
     {
         return E_FAIL;
@@ -1442,7 +1454,7 @@ CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFO lpcmi, LPCITEMIDLIST pidl,
     }
     else
     {
     }
     else
     {
-        SHGetPathFromIDListW(m_Dcm.pidlFolder, wszDir);
+        SHGetPathFromIDListW(m_pidlFolder, wszDir);
     }
 
     HKEY hkeyClass;
     }
 
     HKEY hkeyClass;
@@ -1491,7 +1503,7 @@ CDefaultContextMenu::DoStaticShellExtensions(
     DWORD wFlags = BrowserFlagsFromVerb(lpcmi, pEntry);
     BOOL bBrowsed = FALSE;
 
     DWORD wFlags = BrowserFlagsFromVerb(lpcmi, pEntry);
     BOOL bBrowsed = FALSE;
 
-    for (i=0; i < m_Dcm.cidl; i++)
+    for (i=0; i < m_cidl; i++)
     {
         /* Check if we need to browse */
         if (wFlags > 0)
     {
         /* Check if we need to browse */
         if (wFlags > 0)
@@ -1502,7 +1514,7 @@ CDefaultContextMenu::DoStaticShellExtensions(
             if (bBrowsed)
                 continue;
 
             if (bBrowsed)
                 continue;
 
-            hr = TryToBrowse(lpcmi, m_Dcm.apidl[i], wFlags);
+            hr = TryToBrowse(lpcmi, m_apidl[i], wFlags);
             if (SUCCEEDED(hr))
             {
                 bBrowsed = TRUE;
             if (SUCCEEDED(hr))
             {
                 bBrowsed = TRUE;
@@ -1510,7 +1522,7 @@ CDefaultContextMenu::DoStaticShellExtensions(
             }
         }
 
             }
         }
 
-        InvokePidl(lpcmi, m_Dcm.apidl[i], pEntry);
+        InvokePidl(lpcmi, m_apidl[i], pEntry);
     }
 
     return S_OK;
     }
 
     return S_OK;
index 5a9fc67..34ee529 100644 (file)
@@ -166,7 +166,7 @@ class CDefView :
         virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt);
         virtual HRESULT STDMETHODCALLTYPE GetAutoArrange();
         virtual HRESULT STDMETHODCALLTYPE SelectItem(int iItem, DWORD dwFlags);
         virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt);
         virtual HRESULT STDMETHODCALLTYPE GetAutoArrange();
         virtual HRESULT STDMETHODCALLTYPE SelectItem(int iItem, DWORD dwFlags);
-        virtual HRESULT STDMETHODCALLTYPE SelectAndPositionItems(UINT cidl, LPCITEMIDLIST *apidl, POINT *apt, DWORD dwFlags);
+        virtual HRESULT STDMETHODCALLTYPE SelectAndPositionItems(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD dwFlags);
 
         // *** IShellFolderView methods ***
         virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort);
 
         // *** IShellFolderView methods ***
         virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort);
@@ -2422,7 +2422,7 @@ HRESULT STDMETHODCALLTYPE CDefView::SelectItem(int iItem, DWORD dwFlags)
     return S_OK;
 }
 
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE CDefView::SelectAndPositionItems(UINT cidl, LPCITEMIDLIST *apidl, POINT *apt, DWORD dwFlags)
+HRESULT STDMETHODCALLTYPE CDefView::SelectAndPositionItems(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD dwFlags)
 {
     return E_NOTIMPL;
 }
 {
     return E_NOTIMPL;
 }
index bc80ebb..42e15e8 100644 (file)
@@ -26,11 +26,11 @@ NpCancelWaitQueueIrp(IN PDEVICE_OBJECT DeviceObject,
 
     IoReleaseCancelSpinLock(Irp->CancelIrql);
 
 
     IoReleaseCancelSpinLock(Irp->CancelIrql);
 
-    WaitQueue = (PNP_WAIT_QUEUE)Irp->Tail.Overlay.DriverContext[0];
+    WaitQueue = Irp->Tail.Overlay.DriverContext[0];
 
     KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
 
 
     KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
 
-    WaitEntry = (PNP_WAIT_QUEUE_ENTRY)Irp->Tail.Overlay.DriverContext[1];
+    WaitEntry = Irp->Tail.Overlay.DriverContext[1];
     if (WaitEntry)
     {
         RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
     if (WaitEntry)
     {
         RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
@@ -102,94 +102,91 @@ NpInitializeWaitQueue(IN PNP_WAIT_QUEUE WaitQueue)
 NTSTATUS
 NTAPI
 NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue,
 NTSTATUS
 NTAPI
 NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue,
-               IN PUNICODE_STRING PipeName,
+               IN PUNICODE_STRING PipePath,
                IN NTSTATUS Status,
                IN PLIST_ENTRY List)
 {
                IN NTSTATUS Status,
                IN PLIST_ENTRY List)
 {
-    UNICODE_STRING DestinationString;
+    UNICODE_STRING PipePathUpper;
     KIRQL OldIrql;
     PWCHAR Buffer;
     PLIST_ENTRY NextEntry;
     PNP_WAIT_QUEUE_ENTRY WaitEntry, Linkage;
     PIRP WaitIrp;
     PFILE_PIPE_WAIT_FOR_BUFFER WaitBuffer;
     KIRQL OldIrql;
     PWCHAR Buffer;
     PLIST_ENTRY NextEntry;
     PNP_WAIT_QUEUE_ENTRY WaitEntry, Linkage;
     PIRP WaitIrp;
     PFILE_PIPE_WAIT_FOR_BUFFER WaitBuffer;
-    ULONG i, NameLength;
+    UNICODE_STRING WaitName, PipeName;
 
     Linkage = NULL;
 
     Buffer = ExAllocatePoolWithTag(NonPagedPool,
 
     Linkage = NULL;
 
     Buffer = ExAllocatePoolWithTag(NonPagedPool,
-                                   PipeName->Length,
+                                   PipePath->Length,
                                    NPFS_WAIT_BLOCK_TAG);
     if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES;
 
                                    NPFS_WAIT_BLOCK_TAG);
     if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES;
 
-    RtlInitEmptyUnicodeString(&DestinationString, Buffer, PipeName->Length);
-    RtlUpcaseUnicodeString(&DestinationString, PipeName, FALSE);
+    RtlInitEmptyUnicodeString(&PipePathUpper, Buffer, PipePath->Length);
+    RtlUpcaseUnicodeString(&PipePathUpper, PipePath, FALSE);
 
     KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
 
 
     KeAcquireSpinLock(&WaitQueue->WaitLock, &OldIrql);
 
-    for (NextEntry = WaitQueue->WaitList.Flink;
-         NextEntry != &WaitQueue->WaitList;
-         NextEntry = NextEntry->Flink)
+    NextEntry = WaitQueue->WaitList.Flink;
+    while (NextEntry != &WaitQueue->WaitList)
     {
         WaitIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
     {
         WaitIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
+        NextEntry = NextEntry->Flink;
         WaitEntry = WaitIrp->Tail.Overlay.DriverContext[1];
 
         if (WaitEntry->AliasName.Length)
         {
             ASSERT(FALSE);
         WaitEntry = WaitIrp->Tail.Overlay.DriverContext[1];
 
         if (WaitEntry->AliasName.Length)
         {
             ASSERT(FALSE);
-            if (DestinationString.Length == WaitEntry->AliasName.Length)
-            {
-                if (RtlCompareMemory(WaitEntry->AliasName.Buffer,
-                                     DestinationString.Buffer,
-                                     DestinationString.Length) ==
-                    DestinationString.Length)
-                {
-CancelWait:
-                    RemoveEntryList(&WaitIrp->Tail.Overlay.ListEntry);
-                    if (KeCancelTimer(&WaitEntry->Timer))
-                    {
-                        WaitEntry->WaitQueue = (PNP_WAIT_QUEUE)Linkage;
-                        Linkage = WaitEntry;
-                    }
-                    else
-                    {
-                        WaitEntry->Irp = NULL;
-                        WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
-                    }
-
-                    if (IoSetCancelRoutine(WaitIrp, NULL))
-                    {
-                        WaitIrp->IoStatus.Information = 0;
-                        WaitIrp->IoStatus.Status = Status;
-                        InsertTailList(List, &WaitIrp->Tail.Overlay.ListEntry);
-                    }
-                    else
-                    {
-                        WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
-                    }
-                }
-            }
+            /* We have an alias. Use that for comparison */
+            WaitName = WaitEntry->AliasName;
+            PipeName = PipePathUpper;
         }
         else
         {
         }
         else
         {
+            /* Use the name from the wait buffer to compare */
             WaitBuffer = WaitIrp->AssociatedIrp.SystemBuffer;
             WaitBuffer = WaitIrp->AssociatedIrp.SystemBuffer;
+            WaitName.Buffer = WaitBuffer->Name;
+            WaitName.Length = WaitBuffer->NameLength;
+            WaitName.MaximumLength = WaitName.Length;
+
+            /* WaitName doesn't have a leading backslash,
+             * so skip the one in PipePathUpper for the comparison */
+            PipeName.Buffer = PipePathUpper.Buffer + 1;
+            PipeName.Length = PipePathUpper.Length - sizeof(WCHAR);
+            PipeName.MaximumLength = PipeName.Length;
+        }
 
 
-            if (WaitBuffer->NameLength + sizeof(WCHAR) == DestinationString.Length)
+        if (RtlEqualUnicodeString(&WaitName, &PipeName, FALSE))
+        {
+            /* Found a matching wait. Cancel it */
+            RemoveEntryList(&WaitIrp->Tail.Overlay.ListEntry);
+            if (KeCancelTimer(&WaitEntry->Timer))
+            {
+                WaitEntry->WaitQueue = (PNP_WAIT_QUEUE)Linkage;
+                Linkage = WaitEntry;
+            }
+            else
             {
             {
-                NameLength = WaitBuffer->NameLength / sizeof(WCHAR);
-                for (i = 0; i < NameLength; i++)
-                {
-                    if (WaitBuffer->Name[i] != DestinationString.Buffer[i + 1]) break;
-                }
+                WaitEntry->Irp = NULL;
+                WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
+            }
 
 
-                if (i >= NameLength) goto CancelWait;
+            if (IoSetCancelRoutine(WaitIrp, NULL))
+            {
+                WaitIrp->IoStatus.Information = 0;
+                WaitIrp->IoStatus.Status = Status;
+                InsertTailList(List, &WaitIrp->Tail.Overlay.ListEntry);
+            }
+            else
+            {
+                WaitIrp->Tail.Overlay.DriverContext[1] = NULL;
             }
         }
     }
 
     KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);
 
             }
         }
     }
 
     KeReleaseSpinLock(&WaitQueue->WaitLock, OldIrql);
 
-    ExFreePool(DestinationString.Buffer);
+    ExFreePoolWithTag(Buffer, NPFS_WAIT_BLOCK_TAG);
 
     while (Linkage)
     {
 
     while (Linkage)
     {
index 44a549f..55fa6e3 100644 (file)
@@ -224,21 +224,21 @@ interface IShellFolder : IUnknown
         [out] IEnumIDList **ppenumIDList);
 
     HRESULT BindToObject(
         [out] IEnumIDList **ppenumIDList);
 
     HRESULT BindToObject(
-        [in] LPCITEMIDLIST pidl,
+        [in] PCUIDLIST_RELATIVE pidl,
         [in] LPBC pbcReserved,
         [in] REFIID riid,
         [out, iid_is(riid)] void **ppvOut);
 
     HRESULT BindToStorage(
         [in] LPBC pbcReserved,
         [in] REFIID riid,
         [out, iid_is(riid)] void **ppvOut);
 
     HRESULT BindToStorage(
-        [in] LPCITEMIDLIST pidl,
+        [in] PCUIDLIST_RELATIVE pidl,
         [in] LPBC pbcReserved,
         [in] REFIID riid,
         [out, iid_is(riid)] void **ppvObj);
 
     HRESULT CompareIDs(
         [in] LPARAM lParam,
         [in] LPBC pbcReserved,
         [in] REFIID riid,
         [out, iid_is(riid)] void **ppvObj);
 
     HRESULT CompareIDs(
         [in] LPARAM lParam,
-        [in] LPCITEMIDLIST pidl1,
-        [in] LPCITEMIDLIST pidl2);
+        [in] PCUIDLIST_RELATIVE pidl1,
+        [in] PCUIDLIST_RELATIVE pidl2);
 
     HRESULT CreateViewObject(
         [in] HWND hwndOwner,
 
     HRESULT CreateViewObject(
         [in] HWND hwndOwner,
@@ -247,28 +247,28 @@ interface IShellFolder : IUnknown
 
     HRESULT GetAttributesOf(
         [in] UINT cidl,
 
     HRESULT GetAttributesOf(
         [in] UINT cidl,
-        [in, size_is(cidl)] LPCITEMIDLIST *apidl,
+        [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl,
         [in, out] SFGAOF *rgfInOut);
 
     HRESULT GetUIObjectOf(
         [in] HWND hwndOwner,
         [in] UINT cidl,
         [in, out] SFGAOF *rgfInOut);
 
     HRESULT GetUIObjectOf(
         [in] HWND hwndOwner,
         [in] UINT cidl,
-        [in, size_is(cidl)] LPCITEMIDLIST *apidl,
+        [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl,
         [in] REFIID riid,
         [in, out, unique] UINT *prgfInOut,
         [out, iid_is(riid)] void **ppvOut);
 
     HRESULT GetDisplayNameOf(
         [in] REFIID riid,
         [in, out, unique] UINT *prgfInOut,
         [out, iid_is(riid)] void **ppvOut);
 
     HRESULT GetDisplayNameOf(
-        [in] LPCITEMIDLIST pidl,
+        [in] PCUITEMID_CHILD pidl,
         [in] SHGDNF uFlags,
         [out] STRRET *lpName);
 
     HRESULT SetNameOf(
         [in] HWND hwnd,
         [in] SHGDNF uFlags,
         [out] STRRET *lpName);
 
     HRESULT SetNameOf(
         [in] HWND hwnd,
-        [in] LPCITEMIDLIST pidl,
+        [in] PCUITEMID_CHILD pidl,
         [in, string] LPCOLESTR lpszName,
         [in] SHGDNF uFlags,
         [in, string] LPCOLESTR lpszName,
         [in] SHGDNF uFlags,
-        [out] LPITEMIDLIST *ppidlOut);
+        [out] PITEMID_CHILD *ppidlOut);
 }
 
 
 }
 
 
index 4b64a13..40ec94d 100644 (file)
@@ -656,6 +656,8 @@ void UserDbgAssertThreadInfo(BOOL showCaller)
     ASSERT(pci->ulClientDelta == DesktopHeapGetUserDelta());
     if (pti->pcti && pci->pDeskInfo)
         ASSERT(pci->pClientThreadInfo == (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta));
     ASSERT(pci->ulClientDelta == DesktopHeapGetUserDelta());
     if (pti->pcti && pci->pDeskInfo)
         ASSERT(pci->pClientThreadInfo == (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta));
+    if (pti->pcti && IsListEmpty(&pti->SentMessagesListHead))
+        ASSERT((pti->pcti->fsChangeBits & QS_SENDMESSAGE) == 0);
     if (pti->KeyboardLayout)
         ASSERT(pci->hKL == pti->KeyboardLayout->hkl);
     if(pti->rpdesk != NULL)
     if (pti->KeyboardLayout)
         ASSERT(pci->hKL == pti->KeyboardLayout->hkl);
     if(pti->rpdesk != NULL)
index 3d7a533..a288f97 100644 (file)
@@ -102,7 +102,7 @@ ConvertInputUnicodeToAnsi(PCONSOLE Console,
 /* PRIVATE FUNCTIONS **********************************************************/
 
 static PALIAS_HEADER
 /* PRIVATE FUNCTIONS **********************************************************/
 
 static PALIAS_HEADER
-IntFindAliasHeader(PCONSOLE Console,
+IntFindAliasHeader(PCONSRV_CONSOLE Console,
                    PVOID    ExeName,
                    USHORT   ExeLength,
                    BOOLEAN  UnicodeExe)
                    PVOID    ExeName,
                    USHORT   ExeLength,
                    BOOLEAN  UnicodeExe)
@@ -149,7 +149,7 @@ IntFindAliasHeader(PCONSOLE Console,
 }
 
 static PALIAS_HEADER
 }
 
 static PALIAS_HEADER
-IntCreateAliasHeader(PCONSOLE Console,
+IntCreateAliasHeader(PCONSRV_CONSOLE Console,
                      PVOID    ExeName,
                      USHORT   ExeLength,
                      BOOLEAN  UnicodeExe)
                      PVOID    ExeName,
                      USHORT   ExeLength,
                      BOOLEAN  UnicodeExe)
@@ -217,7 +217,7 @@ IntInsertAliasHeader(PALIAS_HEADER* RootHeader,
 }
 
 static PALIAS_ENTRY
 }
 
 static PALIAS_ENTRY
-IntGetAliasEntry(PCONSOLE Console,
+IntGetAliasEntry(PCONSRV_CONSOLE Console,
                  PALIAS_HEADER Header,
                  PVOID    Source,
                  USHORT   SourceLength,
                  PALIAS_HEADER Header,
                  PVOID    Source,
                  USHORT   SourceLength,
@@ -266,7 +266,7 @@ IntGetAliasEntry(PCONSOLE Console,
 }
 
 static PALIAS_ENTRY
 }
 
 static PALIAS_ENTRY
-IntCreateAliasEntry(PCONSOLE Console,
+IntCreateAliasEntry(PCONSRV_CONSOLE Console,
                     PVOID    Source,
                     USHORT   SourceLength,
                     PVOID    Target,
                     PVOID    Source,
                     USHORT   SourceLength,
                     PVOID    Target,
@@ -425,7 +425,7 @@ IntGetAllConsoleAliasesLength(PALIAS_HEADER Header,
 }
 
 VOID
 }
 
 VOID
-IntDeleteAllAliases(PCONSOLE Console)
+IntDeleteAllAliases(PCONSRV_CONSOLE Console)
 {
     PALIAS_HEADER Header, NextHeader;
     PALIAS_ENTRY Entry, NextEntry;
 {
     PALIAS_HEADER Header, NextHeader;
     PALIAS_ENTRY Entry, NextEntry;
@@ -449,7 +449,7 @@ CSR_API(SrvAddConsoleAlias)
 {
     NTSTATUS Status;
     PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
 {
     NTSTATUS Status;
     PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
     PVOID lpTarget;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
     PVOID lpTarget;
@@ -538,7 +538,7 @@ CSR_API(SrvGetConsoleAlias)
 {
     NTSTATUS Status;
     PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
 {
     NTSTATUS Status;
     PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
     UINT Length;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
     UINT Length;
@@ -629,7 +629,7 @@ CSR_API(SrvGetConsoleAliases)
 {
     NTSTATUS Status;
     PCONSOLE_GETALLALIASES GetAllAliasesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETALLALIASES GetAllAliasesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     ULONG BytesWritten = 0;
     PALIAS_HEADER Header;
 
     ULONG BytesWritten = 0;
     PALIAS_HEADER Header;
 
@@ -734,7 +734,7 @@ CSR_API(SrvGetConsoleAliasesLength)
 {
     NTSTATUS Status;
     PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesLengthRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesLengthRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PALIAS_HEADER Header;
 
     DPRINT1("SrvGetConsoleAliasesLength entered ApiMessage %p\n", ApiMessage);
     PALIAS_HEADER Header;
 
     DPRINT1("SrvGetConsoleAliasesLength entered ApiMessage %p\n", ApiMessage);
@@ -774,7 +774,7 @@ CSR_API(SrvGetConsoleAliasExes)
 {
     NTSTATUS Status;
     PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     UINT BytesWritten = 0;
 
     DPRINT1("SrvGetConsoleAliasExes entered\n");
     UINT BytesWritten = 0;
 
     DPRINT1("SrvGetConsoleAliasExes entered\n");
@@ -860,7 +860,7 @@ CSR_API(SrvGetConsoleAliasExesLength)
 {
     NTSTATUS Status;
     PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesLengthRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesLengthRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     DPRINT1("SrvGetConsoleAliasExesLength entered ApiMessage %p\n", ApiMessage);
 
 
     DPRINT1("SrvGetConsoleAliasExesLength entered ApiMessage %p\n", ApiMessage);
 
index d3653e5..38505d1 100644 (file)
@@ -9,4 +9,4 @@
 
 #pragma once
 
 
 #pragma once
 
-VOID IntDeleteAllAliases(PCONSOLE Console);
+VOID IntDeleteAllAliases(PCONSRV_CONSOLE Console);
index b0f7099..4f60730 100644 (file)
@@ -233,7 +233,6 @@ ConDrvInitConsole(OUT PCONSOLE* NewConsole,
     /* Initialize the terminal interface */
     ResetTerminal(Console);
 
     /* Initialize the terminal interface */
     ResetTerminal(Console);
 
-    memcpy(Console->Colors, ConsoleInfo->Colors, sizeof(ConsoleInfo->Colors));
     Console->ConsoleSize = ConsoleInfo->ConsoleSize;
     Console->FixedSize   = FALSE; // Value by default; is reseted by the terminals if needed.
 
     Console->ConsoleSize = ConsoleInfo->ConsoleSize;
     Console->FixedSize   = FALSE; // Value by default; is reseted by the terminals if needed.
 
index 738e819..953451e 100644 (file)
@@ -40,7 +40,7 @@ typedef struct _GET_INPUT_INFO
  * This pre-processing code MUST be IN consrv ONLY
  */
 /* static */ ULONG
  * This pre-processing code MUST be IN consrv ONLY
  */
 /* static */ ULONG
-PreprocessInput(PCONSOLE Console,
+PreprocessInput(PCONSRV_CONSOLE Console,
                 PINPUT_RECORD InputEvent,
                 ULONG NumEventsToWrite)
 {
                 PINPUT_RECORD InputEvent,
                 ULONG NumEventsToWrite)
 {
@@ -102,7 +102,7 @@ PreprocessInput(PCONSOLE Console,
  * This post-processing code MUST be IN consrv ONLY
  */
 /* static */ VOID
  * This post-processing code MUST be IN consrv ONLY
  */
 /* static */ VOID
-PostprocessInput(PCONSOLE Console)
+PostprocessInput(PCONSRV_CONSOLE Console)
 {
     CsrNotifyWait(&Console->ReadWaitQueue,
                   FALSE,
 {
     CsrNotifyWait(&Console->ReadWaitQueue,
                   FALSE,
index 12a4d4d..ab911f7 100644 (file)
@@ -170,7 +170,7 @@ CSR_API(SrvCreateConsoleScreenBuffer)
     NTSTATUS Status = STATUS_INVALID_PARAMETER;
     PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
     NTSTATUS Status = STATUS_INVALID_PARAMETER;
     PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     PVOID ScreenBufferInfo = NULL;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     PVOID ScreenBufferInfo = NULL;
index fb0ddf7..a5d7c65 100644 (file)
@@ -26,7 +26,7 @@ NTSTATUS NTAPI RtlGetLastNtStatus(VOID);
 /* GLOBALS ********************************************************************/
 
 static ULONG ConsoleListSize;
 /* GLOBALS ********************************************************************/
 
 static ULONG ConsoleListSize;
-static PCONSOLE* ConsoleList;   /* The list of the ConSrv consoles */
+static PCONSRV_CONSOLE* ConsoleList;   /* The list of the ConSrv consoles */
 static RTL_RESOURCE ListLock;
 
 #define ConSrvLockConsoleListExclusive()    \
 static RTL_RESOURCE ListLock;
 
 #define ConSrvLockConsoleListExclusive()    \
@@ -41,13 +41,13 @@ static RTL_RESOURCE ListLock;
 
 static NTSTATUS
 InsertConsole(OUT PHANDLE Handle,
 
 static NTSTATUS
 InsertConsole(OUT PHANDLE Handle,
-              IN PCONSOLE Console)
+              IN PCONSRV_CONSOLE Console)
 {
 #define CONSOLE_HANDLES_INCREMENT   2 * 3
 
     NTSTATUS Status = STATUS_SUCCESS;
     ULONG i = 0;
 {
 #define CONSOLE_HANDLES_INCREMENT   2 * 3
 
     NTSTATUS Status = STATUS_SUCCESS;
     ULONG i = 0;
-    PCONSOLE* Block;
+    PCONSRV_CONSOLE* Block;
 
     ASSERT( (ConsoleList == NULL && ConsoleListSize == 0) ||
             (ConsoleList != NULL && ConsoleListSize != 0) );
 
     ASSERT( (ConsoleList == NULL && ConsoleListSize == 0) ||
             (ConsoleList != NULL && ConsoleListSize != 0) );
@@ -70,7 +70,7 @@ InsertConsole(OUT PHANDLE Handle,
         /* Allocate a new handles table */
         Block = ConsoleAllocHeap(HEAP_ZERO_MEMORY,
                                  (ConsoleListSize +
         /* Allocate a new handles table */
         Block = ConsoleAllocHeap(HEAP_ZERO_MEMORY,
                                  (ConsoleListSize +
-                                    CONSOLE_HANDLES_INCREMENT) * sizeof(PCONSOLE));
+                                    CONSOLE_HANDLES_INCREMENT) * sizeof(PCONSRV_CONSOLE));
         if (Block == NULL)
         {
             Status = STATUS_UNSUCCESSFUL;
         if (Block == NULL)
         {
             Status = STATUS_UNSUCCESSFUL;
@@ -83,7 +83,7 @@ InsertConsole(OUT PHANDLE Handle,
             /* Copy the handles from the old table to the new one */
             RtlCopyMemory(Block,
                           ConsoleList,
             /* Copy the handles from the old table to the new one */
             RtlCopyMemory(Block,
                           ConsoleList,
-                          ConsoleListSize * sizeof(PCONSOLE));
+                          ConsoleListSize * sizeof(PCONSRV_CONSOLE));
             ConsoleFreeHeap(ConsoleList);
         }
         ConsoleList = Block;
             ConsoleFreeHeap(ConsoleList);
         }
         ConsoleList = Block;
@@ -105,7 +105,7 @@ static NTSTATUS
 RemoveConsoleByHandle(IN HANDLE Handle)
 {
     NTSTATUS Status = STATUS_SUCCESS;
 RemoveConsoleByHandle(IN HANDLE Handle)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     BOOLEAN ValidHandle = ((HandleToULong(Handle) & 0x3) == 0x3);
     ULONG Index = HandleToULong(Handle) >> 2;
 
     BOOLEAN ValidHandle = ((HandleToULong(Handle) & 0x3) == 0x3);
     ULONG Index = HandleToULong(Handle) >> 2;
@@ -135,7 +135,7 @@ Quit:
 #endif
 
 static NTSTATUS
 #endif
 
 static NTSTATUS
-RemoveConsoleByPointer(IN PCONSOLE Console)
+RemoveConsoleByPointer(IN PCONSRV_CONSOLE Console)
 {
     ULONG i = 0;
 
 {
     ULONG i = 0;
 
@@ -162,13 +162,13 @@ RemoveConsoleByPointer(IN PCONSOLE Console)
 }
 
 BOOLEAN NTAPI
 }
 
 BOOLEAN NTAPI
-ConSrvValidateConsole(OUT PCONSOLE* Console,
+ConSrvValidateConsole(OUT PCONSRV_CONSOLE* Console,
                       IN HANDLE ConsoleHandle,
                       IN CONSOLE_STATE ExpectedState,
                       IN BOOLEAN LockConsole)
 {
     BOOLEAN RetVal = FALSE;
                       IN HANDLE ConsoleHandle,
                       IN CONSOLE_STATE ExpectedState,
                       IN BOOLEAN LockConsole)
 {
     BOOLEAN RetVal = FALSE;
-    PCONSOLE ValidatedConsole;
+    PCONSRV_CONSOLE ValidatedConsole;
 
     BOOLEAN ValidHandle = ((HandleToULong(ConsoleHandle) & 0x3) == 0x3);
     ULONG Index = HandleToULong(ConsoleHandle) >> 2;
 
     BOOLEAN ValidHandle = ((HandleToULong(ConsoleHandle) & 0x3) == 0x3);
     ULONG Index = HandleToULong(ConsoleHandle) >> 2;
@@ -210,14 +210,14 @@ ConSrvValidateConsole(OUT PCONSOLE* Console,
 /* PRIVATE FUNCTIONS **********************************************************/
 
 VOID
 /* PRIVATE FUNCTIONS **********************************************************/
 
 VOID
-ConioPause(PCONSOLE Console, UINT Flags)
+ConioPause(PCONSRV_CONSOLE Console, UINT Flags)
 {
     Console->PauseFlags |= Flags;
     ConDrvPause(Console);
 }
 
 VOID
 {
     Console->PauseFlags |= Flags;
     ConDrvPause(Console);
 }
 
 VOID
-ConioUnpause(PCONSOLE Console, UINT Flags)
+ConioUnpause(PCONSRV_CONSOLE Console, UINT Flags)
 {
     Console->PauseFlags &= ~Flags;
 
 {
     Console->PauseFlags &= ~Flags;
 
@@ -239,11 +239,11 @@ ConioUnpause(PCONSOLE Console, UINT Flags)
 
 NTSTATUS
 ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData,
 
 NTSTATUS
 ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData,
-                 OUT PCONSOLE* Console,
+                 OUT PCONSRV_CONSOLE* Console,
                  IN BOOLEAN LockConsole)
 {
     NTSTATUS Status = STATUS_INVALID_HANDLE;
                  IN BOOLEAN LockConsole)
 {
     NTSTATUS Status = STATUS_INVALID_HANDLE;
-    PCONSOLE GrabConsole;
+    PCONSRV_CONSOLE GrabConsole;
 
     // if (Console == NULL) return STATUS_INVALID_PARAMETER;
     ASSERT(Console);
 
     // if (Console == NULL) return STATUS_INVALID_PARAMETER;
     ASSERT(Console);
@@ -266,7 +266,7 @@ ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData,
 }
 
 VOID
 }
 
 VOID
-ConSrvReleaseConsole(IN PCONSOLE Console,
+ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console,
                      IN BOOLEAN WasConsoleLocked)
 {
     LONG RefCount = 0;
                      IN BOOLEAN WasConsoleLocked)
 {
     LONG RefCount = 0;
@@ -319,13 +319,13 @@ ConSrvDeinitTerminal(IN OUT PTERMINAL Terminal);
 
 NTSTATUS NTAPI
 ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
 
 NTSTATUS NTAPI
 ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
-                  OUT PCONSOLE* NewConsole,
+                  OUT PCONSRV_CONSOLE* NewConsole,
                   IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
                   IN ULONG ConsoleLeaderProcessId)
 {
     NTSTATUS Status;
     HANDLE ConsoleHandle;
                   IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
                   IN ULONG ConsoleLeaderProcessId)
 {
     NTSTATUS Status;
     HANDLE ConsoleHandle;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     CONSOLE_INFO ConsoleInfo;
     SIZE_T Length = 0;
 
     CONSOLE_INFO ConsoleInfo;
     SIZE_T Length = 0;
 
@@ -429,6 +429,9 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
 
     Console->QuickEdit = ConsoleInfo.QuickEdit;
 
 
     Console->QuickEdit = ConsoleInfo.QuickEdit;
 
+    /* Colour table */
+    memcpy(Console->Colors, ConsoleInfo.Colors, sizeof(ConsoleInfo.Colors));
+
     /* Attach the ConSrv terminal to the console */
     Status = ConDrvRegisterTerminal(Console, &Terminal);
     if (!NT_SUCCESS(Status))
     /* Attach the ConSrv terminal to the console */
     Status = ConDrvRegisterTerminal(Console, &Terminal);
     if (!NT_SUCCESS(Status))
@@ -450,7 +453,7 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
 }
 
 VOID NTAPI
 }
 
 VOID NTAPI
-ConSrvDeleteConsole(PCONSOLE Console)
+ConSrvDeleteConsole(PCONSRV_CONSOLE Console)
 {
     DPRINT("ConSrvDeleteConsole\n");
 
 {
     DPRINT("ConSrvDeleteConsole\n");
 
@@ -528,7 +531,7 @@ ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
 }
 
 PCONSOLE_PROCESS_DATA NTAPI
 }
 
 PCONSOLE_PROCESS_DATA NTAPI
-ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console)
+ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console)
 {
     if (Console == NULL) return NULL;
 
 {
     if (Console == NULL) return NULL;
 
@@ -538,7 +541,7 @@ ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console)
 }
 
 NTSTATUS NTAPI
 }
 
 NTSTATUS NTAPI
-ConSrvGetConsoleProcessList(IN PCONSOLE Console,
+ConSrvGetConsoleProcessList(IN PCONSRV_CONSOLE Console,
                             IN OUT PULONG ProcessIdsList,
                             IN ULONG MaxIdListItems,
                             OUT PULONG ProcessIdsTotal)
                             IN OUT PULONG ProcessIdsList,
                             IN ULONG MaxIdListItems,
                             OUT PULONG ProcessIdsTotal)
@@ -567,7 +570,7 @@ ConSrvGetConsoleProcessList(IN PCONSOLE Console,
 
 // ConSrvGenerateConsoleCtrlEvent
 NTSTATUS NTAPI
 
 // ConSrvGenerateConsoleCtrlEvent
 NTSTATUS NTAPI
-ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
+ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console,
                               IN ULONG ProcessGroupId,
                               IN ULONG CtrlEvent)
 {
                               IN ULONG ProcessGroupId,
                               IN ULONG CtrlEvent)
 {
@@ -795,7 +798,7 @@ CSR_API(SrvGetConsoleTitle)
 {
     NTSTATUS Status;
     PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&TitleRequest->Title,
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&TitleRequest->Title,
@@ -830,7 +833,7 @@ CSR_API(SrvSetConsoleTitle)
 {
     NTSTATUS Status;
     PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&TitleRequest->Title,
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&TitleRequest->Title,
@@ -865,7 +868,7 @@ CSR_API(SrvGetConsoleCP)
 {
     NTSTATUS Status;
     PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleCPRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleCPRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
             GetConsoleCPRequest->OutputCP ? "Output" : "Input");
 
     DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
             GetConsoleCPRequest->OutputCP ? "Output" : "Input");
@@ -889,7 +892,7 @@ CSR_API(SrvSetConsoleCP)
 {
     NTSTATUS Status = STATUS_INVALID_PARAMETER;
     PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleCPRequest;
 {
     NTSTATUS Status = STATUS_INVALID_PARAMETER;
     PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleCPRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
             SetConsoleCPRequest->OutputCP ? "Output" : "Input");
 
     DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
             SetConsoleCPRequest->OutputCP ? "Output" : "Input");
@@ -909,7 +912,7 @@ CSR_API(SrvGetConsoleProcessList)
 {
     NTSTATUS Status;
     PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&GetProcessListRequest->ProcessIdsList,
 
     if (!CsrValidateMessageBuffer(ApiMessage,
                                   (PVOID)&GetProcessListRequest->ProcessIdsList,
@@ -935,7 +938,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
 {
     NTSTATUS Status;
     PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
@@ -952,7 +955,7 @@ CSR_API(SrvConsoleNotifyLastClose)
 {
     NTSTATUS Status;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
 {
     NTSTATUS Status;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
@@ -979,7 +982,7 @@ CSR_API(SrvGetConsoleMouseInfo)
 {
     NTSTATUS Status;
     PCONSOLE_GETMOUSEINFO GetMouseInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetMouseInfoRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETMOUSEINFO GetMouseInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetMouseInfoRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
@@ -1001,7 +1004,7 @@ CSR_API(SrvGetConsoleKeyboardLayoutName)
 {
     NTSTATUS Status;
     PCONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetKbdLayoutNameRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetKbdLayoutNameRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
index 57a0acf..2c9c1e7 100644 (file)
@@ -67,6 +67,7 @@ typedef struct _CONSOLE_PROCESS_DATA
 } CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
 
 #include "include/conio.h"
 } CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
 
 #include "include/conio.h"
+// #include "include/conio_winsrv.h"
 #include "include/console.h"
 #include "include/settings.h"
 #include "include/term.h"
 #include "include/console.h"
 #include "include/settings.h"
 #include "include/term.h"
index e8545ec..24bef40 100644 (file)
@@ -31,7 +31,7 @@
  */
 #if 0
 static NTSTATUS
  */
 #if 0
 static NTSTATUS
-SetConsoleHardwareState(PCONSOLE Console, ULONG ConsoleHwState)
+SetConsoleHardwareState(PCONSRV_CONSOLE Console, ULONG ConsoleHwState)
 {
     DPRINT1("Console Hardware State: %d\n", ConsoleHwState);
 
 {
     DPRINT1("Console Hardware State: %d\n", ConsoleHwState);
 
@@ -58,7 +58,7 @@ CSR_API(SrvGetConsoleHardwareState)
     NTSTATUS Status;
     PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
     NTSTATUS Status;
     PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    HardwareStateRequest->OutputHandle,
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    HardwareStateRequest->OutputHandle,
@@ -88,7 +88,7 @@ CSR_API(SrvSetConsoleHardwareState)
     NTSTATUS Status;
     PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
     NTSTATUS Status;
     PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    HardwareStateRequest->OutputHandle,
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    HardwareStateRequest->OutputHandle,
@@ -117,7 +117,7 @@ CSR_API(SrvGetConsoleDisplayMode)
 {
     NTSTATUS Status;
     PCONSOLE_GETDISPLAYMODE GetDisplayModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetDisplayModeRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETDISPLAYMODE GetDisplayModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetDisplayModeRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                               &Console, TRUE);
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                               &Console, TRUE);
@@ -133,7 +133,7 @@ CSR_API(SrvSetConsoleDisplayMode)
 {
     NTSTATUS Status;
     PCONSOLE_SETDISPLAYMODE SetDisplayModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetDisplayModeRequest;
 {
     NTSTATUS Status;
     PCONSOLE_SETDISPLAYMODE SetDisplayModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetDisplayModeRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
@@ -164,7 +164,7 @@ CSR_API(SrvGetLargestConsoleWindowSize)
     NTSTATUS Status;
     PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
     NTSTATUS Status;
     PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
     PCONSOLE_SCREEN_BUFFER Buff;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    GetLargestWindowSizeRequest->OutputHandle,
 
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                    GetLargestWindowSizeRequest->OutputHandle,
@@ -184,7 +184,7 @@ CSR_API(SrvShowConsoleCursor)
 {
     NTSTATUS Status;
     PCONSOLE_SHOWCURSOR ShowCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ShowCursorRequest;
 {
     NTSTATUS Status;
     PCONSOLE_SHOWCURSOR ShowCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ShowCursorRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
@@ -207,7 +207,7 @@ CSR_API(SrvSetConsoleCursor)
     NTSTATUS Status;
     BOOL Success;
     PCONSOLE_SETCURSOR SetCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorRequest;
     NTSTATUS Status;
     BOOL Success;
     PCONSOLE_SETCURSOR SetCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     // FIXME: Tests show that this function is used only for graphics screen buffers
     PCONSOLE_SCREEN_BUFFER Buff;
 
     // FIXME: Tests show that this function is used only for graphics screen buffers
@@ -232,7 +232,7 @@ CSR_API(SrvConsoleMenuControl)
 {
     NTSTATUS Status;
     PCONSOLE_MENUCONTROL MenuControlRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.MenuControlRequest;
 {
     NTSTATUS Status;
     PCONSOLE_MENUCONTROL MenuControlRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.MenuControlRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
     PCONSOLE_SCREEN_BUFFER Buff;
 
     Status = ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
@@ -257,7 +257,7 @@ CSR_API(SrvSetConsoleMenuClose)
     NTSTATUS Status;
     BOOL Success;
     PCONSOLE_SETMENUCLOSE SetMenuCloseRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetMenuCloseRequest;
     NTSTATUS Status;
     BOOL Success;
     PCONSOLE_SETMENUCLOSE SetMenuCloseRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetMenuCloseRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                               &Console, TRUE);
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                               &Console, TRUE);
@@ -273,7 +273,7 @@ CSR_API(SrvGetConsoleWindow)
 {
     NTSTATUS Status;
     PCONSOLE_GETWINDOW GetWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetWindowRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETWINDOW GetWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetWindowRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
@@ -288,7 +288,7 @@ CSR_API(SrvSetConsoleIcon)
 {
     NTSTATUS Status;
     PCONSOLE_SETICON SetIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetIconRequest;
 {
     NTSTATUS Status;
     PCONSOLE_SETICON SetIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetIconRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
@@ -305,7 +305,7 @@ CSR_API(SrvGetConsoleSelectionInfo)
 {
     NTSTATUS Status;
     PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (!NT_SUCCESS(Status)) return Status;
index 2a7ff36..84de187 100644 (file)
@@ -282,7 +282,7 @@ CreateSysMenu(HWND hWnd)
 }
 
 static VOID
 }
 
 static VOID
-SendMenuEvent(PCONSOLE Console, UINT CmdId)
+SendMenuEvent(PCONSRV_CONSOLE Console, UINT CmdId)
 {
     INPUT_RECORD er;
 
 {
     INPUT_RECORD er;
 
@@ -366,7 +366,7 @@ static LRESULT
 OnCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
 {
     LRESULT Ret = TRUE;
 OnCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
 {
     LRESULT Ret = TRUE;
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
 
     /*
      * In case the selected menu item belongs to the user-reserved menu id range,
 
     /*
      * In case the selected menu item belongs to the user-reserved menu id range,
@@ -486,75 +486,106 @@ ResizeConWnd(PGUI_CONSOLE_DATA GuiData, DWORD WidthUnit, DWORD HeightUnit)
     // to: InvalidateRect(GuiData->hWindow, NULL, TRUE);
 }
 
     // to: InvalidateRect(GuiData->hWindow, NULL, TRUE);
 }
 
-static BOOL
-OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
-{
-    PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams;
-    PCONSOLE Console;
-    HDC hDC;
-    HFONT OldFont;
-    TEXTMETRICW Metrics;
-    SIZE CharSize;
 
 
-    if (NULL == GuiData)
+VOID
+DeleteFonts(PGUI_CONSOLE_DATA GuiData)
+{
+    ULONG i;
+    for (i = 0; i < sizeof(GuiData->Font) / sizeof(GuiData->Font[0]); ++i)
     {
     {
-        DPRINT1("GuiConsoleNcCreate: No GUI data\n");
-        return FALSE;
+        if (GuiData->Font[i] != NULL) DeleteObject(GuiData->Font[i]);
+        GuiData->Font[i] = NULL;
     }
     }
+}
 
 
-    Console = GuiData->Console;
+static HFONT
+CreateDerivedFont(HFONT OrgFont,
+                  // COORD   FontSize,
+                  ULONG   FontWeight,
+                  // BOOLEAN bItalic,
+                  BOOLEAN bUnderline,
+                  BOOLEAN bStrikeOut)
+{
+    LOGFONT lf;
 
 
-    GuiData->hWindow = hWnd;
+    /* Initialize the LOGFONT structure */
+    RtlZeroMemory(&lf, sizeof(lf));
+
+    /* Retrieve the details of the current font */
+    if (GetObject(OrgFont, sizeof(lf), &lf) == 0)
+        return NULL;
+
+    /* Change the font attributes */
+    // lf.lfHeight = FontSize.Y;
+    // lf.lfWidth  = FontSize.X;
+    lf.lfWeight = FontWeight;
+    // lf.lfItalic = bItalic;
+    lf.lfUnderline = bUnderline;
+    lf.lfStrikeOut = bStrikeOut;
+
+    /* Build a new font */
+    return CreateFontIndirect(&lf);
+}
+
+BOOL
+InitFonts(PGUI_CONSOLE_DATA GuiData,
+          LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements.
+          ULONG  FontFamily,
+          COORD  FontSize,
+          ULONG  FontWeight)
+{
+    HDC hDC;
+    HFONT OldFont, NewFont;
+    TEXTMETRICW Metrics;
+    SIZE CharSize;
+
+    /*
+     * Initialize a new NORMAL font and get its metrics.
+     */
 
 
-    GuiData->Font = CreateFontW(GuiData->GuiInfo.FontSize.Y,
-                                0, // GuiData->GuiInfo.FontSize.X,
-                                0,
-                                TA_BASELINE,
-                                GuiData->GuiInfo.FontWeight,
-                                FALSE,
-                                FALSE,
-                                FALSE,
-                                OEM_CHARSET,
-                                OUT_DEFAULT_PRECIS,
-                                CLIP_DEFAULT_PRECIS,
-                                NONANTIALIASED_QUALITY,
-                                FIXED_PITCH | GuiData->GuiInfo.FontFamily /* FF_DONTCARE */,
-                                GuiData->GuiInfo.FaceName);
-
-    if (NULL == GuiData->Font)
+    NewFont = CreateFontW(FontSize.Y,
+                          FontSize.X,
+                          0,
+                          TA_BASELINE,
+                          FontWeight,
+                          FALSE,
+                          FALSE,
+                          FALSE,
+                          OEM_CHARSET,
+                          OUT_DEFAULT_PRECIS,
+                          CLIP_DEFAULT_PRECIS,
+                          DEFAULT_QUALITY, // NONANTIALIASED_QUALITY ; ANTIALIASED_QUALITY
+                          FIXED_PITCH | FontFamily,
+                          FaceName);
+    if (NewFont == NULL)
     {
     {
-        DPRINT1("GuiConsoleNcCreate: CreateFont failed\n");
-        GuiData->hWindow = NULL;
-        SetEvent(GuiData->hGuiInitEvent);
+        DPRINT1("InitFonts: CreateFontW failed\n");
         return FALSE;
     }
         return FALSE;
     }
+
     hDC = GetDC(GuiData->hWindow);
     hDC = GetDC(GuiData->hWindow);
-    if (NULL == hDC)
+    if (hDC == NULL)
     {
     {
-        DPRINT1("GuiConsoleNcCreate: GetDC failed\n");
-        DeleteObject(GuiData->Font);
-        GuiData->hWindow = NULL;
-        SetEvent(GuiData->hGuiInitEvent);
+        DPRINT1("InitFonts: GetDC failed\n");
+        DeleteObject(NewFont);
         return FALSE;
     }
         return FALSE;
     }
-    OldFont = SelectObject(hDC, GuiData->Font);
-    if (NULL == OldFont)
+
+    OldFont = SelectObject(hDC, NewFont);
+    if (OldFont == NULL)
     {
     {
-        DPRINT1("GuiConsoleNcCreate: SelectObject failed\n");
+        DPRINT1("InitFonts: SelectObject failed\n");
         ReleaseDC(GuiData->hWindow, hDC);
         ReleaseDC(GuiData->hWindow, hDC);
-        DeleteObject(GuiData->Font);
-        GuiData->hWindow = NULL;
-        SetEvent(GuiData->hGuiInitEvent);
+        DeleteObject(NewFont);
         return FALSE;
     }
         return FALSE;
     }
+
     if (!GetTextMetricsW(hDC, &Metrics))
     {
     if (!GetTextMetricsW(hDC, &Metrics))
     {
-        DPRINT1("GuiConsoleNcCreate: GetTextMetrics failed\n");
+        DPRINT1("InitFonts: GetTextMetrics failed\n");
         SelectObject(hDC, OldFont);
         ReleaseDC(GuiData->hWindow, hDC);
         SelectObject(hDC, OldFont);
         ReleaseDC(GuiData->hWindow, hDC);
-        DeleteObject(GuiData->Font);
-        GuiData->hWindow = NULL;
-        SetEvent(GuiData->hGuiInitEvent);
+        DeleteObject(NewFont);
         return FALSE;
     }
     GuiData->CharWidth  = Metrics.tmMaxCharWidth;
         return FALSE;
     }
     GuiData->CharWidth  = Metrics.tmMaxCharWidth;
@@ -565,9 +596,80 @@ OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
         GuiData->CharWidth = CharSize.cx;
 
     SelectObject(hDC, OldFont);
         GuiData->CharWidth = CharSize.cx;
 
     SelectObject(hDC, OldFont);
-
     ReleaseDC(GuiData->hWindow, hDC);
 
     ReleaseDC(GuiData->hWindow, hDC);
 
+    /*
+     * Initialization succeeded.
+     */
+    // Delete all the old fonts first.
+    DeleteFonts(GuiData);
+    GuiData->Font[FONT_NORMAL] = NewFont;
+
+    /*
+     * Now build the other fonts (bold, underlined, mixed).
+     */
+    GuiData->Font[FONT_BOLD] =
+        CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+                          FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
+                          FALSE,
+                          FALSE);
+    GuiData->Font[FONT_UNDERLINE] =
+        CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+                          FontWeight,
+                          TRUE,
+                          FALSE);
+    GuiData->Font[FONT_BOLD | FONT_UNDERLINE] =
+        CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+                          FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
+                          TRUE,
+                          FALSE);
+
+    /*
+     * Save the settings.
+     */
+    if (FaceName != GuiData->GuiInfo.FaceName)
+    {
+        SIZE_T Length = min(wcslen(FaceName) + 1, LF_FACESIZE); // wcsnlen
+        wcsncpy(GuiData->GuiInfo.FaceName, FaceName, LF_FACESIZE);
+        GuiData->GuiInfo.FaceName[Length] = L'\0'; // NULL-terminate
+    }
+    GuiData->GuiInfo.FontFamily = FontFamily;
+    GuiData->GuiInfo.FontSize   = FontSize;
+    GuiData->GuiInfo.FontWeight = FontWeight;
+
+    return TRUE;
+}
+
+
+static BOOL
+OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
+{
+    PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams;
+    PCONSRV_CONSOLE Console;
+
+    if (NULL == GuiData)
+    {
+        DPRINT1("GuiConsoleNcCreate: No GUI data\n");
+        return FALSE;
+    }
+
+    Console = GuiData->Console;
+
+    GuiData->hWindow = hWnd;
+
+    /* Initialize the fonts */
+    if (!InitFonts(GuiData,
+                   GuiData->GuiInfo.FaceName,
+                   GuiData->GuiInfo.FontFamily,
+                   GuiData->GuiInfo.FontSize,
+                   GuiData->GuiInfo.FontWeight))
+    {
+        DPRINT1("GuiConsoleNcCreate: InitFonts failed\n");
+        GuiData->hWindow = NULL;
+        SetEvent(GuiData->hGuiInitEvent);
+        return FALSE;
+    }
+
     /* Initialize the terminal framebuffer */
     GuiData->hMemDC  = CreateCompatibleDC(NULL);
     GuiData->hBitmap = NULL;
     /* Initialize the terminal framebuffer */
     GuiData->hMemDC  = CreateCompatibleDC(NULL);
     GuiData->hBitmap = NULL;
@@ -647,7 +749,7 @@ OnActivate(PGUI_CONSOLE_DATA GuiData, WPARAM wParam)
 static VOID
 OnFocus(PGUI_CONSOLE_DATA GuiData, BOOL SetFocus)
 {
 static VOID
 OnFocus(PGUI_CONSOLE_DATA GuiData, BOOL SetFocus)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     INPUT_RECORD er;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
     INPUT_RECORD er;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
@@ -814,7 +916,7 @@ UpdateSelection(PGUI_CONSOLE_DATA GuiData,
                 PCOORD SelectionAnchor OPTIONAL,
                 PCOORD coord)
 {
                 PCOORD SelectionAnchor OPTIONAL,
                 PCOORD coord)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     HRGN oldRgn = CreateSelectionRgn(GuiData, GuiData->LineSelection,
                                      &GuiData->Selection.dwSelectionAnchor,
                                      &GuiData->Selection.srSelection);
     HRGN oldRgn = CreateSelectionRgn(GuiData, GuiData->LineSelection,
                                      &GuiData->Selection.dwSelectionAnchor,
                                      &GuiData->Selection.srSelection);
@@ -1039,7 +1141,7 @@ IsSystemKey(WORD VirtualKeyCode)
 static VOID
 OnKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 static VOID
 OnKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
@@ -1204,7 +1306,7 @@ InvalidateCell(PGUI_CONSOLE_DATA GuiData,
 static VOID
 OnTimer(PGUI_CONSOLE_DATA GuiData)
 {
 static VOID
 OnTimer(PGUI_CONSOLE_DATA GuiData)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_SCREEN_BUFFER Buff;
 
     SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CURSOR_BLINK_TIME, NULL);
     PCONSOLE_SCREEN_BUFFER Buff;
 
     SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CURSOR_BLINK_TIME, NULL);
@@ -1309,7 +1411,7 @@ OnTimer(PGUI_CONSOLE_DATA GuiData)
 static BOOL
 OnClose(PGUI_CONSOLE_DATA GuiData)
 {
 static BOOL
 OnClose(PGUI_CONSOLE_DATA GuiData)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
         return TRUE;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
         return TRUE;
@@ -1341,7 +1443,7 @@ OnNcDestroy(HWND hWnd)
         if (GuiData->hMemDC ) DeleteDC(GuiData->hMemDC);
         if (GuiData->hBitmap) DeleteObject(GuiData->hBitmap);
         // if (GuiData->hSysPalette) DeleteObject(GuiData->hSysPalette);
         if (GuiData->hMemDC ) DeleteDC(GuiData->hMemDC);
         if (GuiData->hBitmap) DeleteObject(GuiData->hBitmap);
         // if (GuiData->hSysPalette) DeleteObject(GuiData->hSysPalette);
-        if (GuiData->Font) DeleteObject(GuiData->Font);
+        DeleteFonts(GuiData);
     }
 
     /* Free the GuiData registration */
     }
 
     /* Free the GuiData registration */
@@ -1380,7 +1482,7 @@ static LRESULT
 OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     BOOL Err = FALSE;
 OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     BOOL Err = FALSE;
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
 
     // FIXME: It's here that we need to check whether we has focus or not
     // and whether we are in edit mode or not, to know if we need to deal
 
     // FIXME: It's here that we need to check whether we has focus or not
     // and whether we are in edit mode or not, to know if we need to deal
@@ -1735,7 +1837,7 @@ Paste(PGUI_CONSOLE_DATA GuiData)
 static VOID
 OnGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo)
 {
 static VOID
 OnGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;
     DWORD windx, windy;
     UINT  WidthUnit, HeightUnit;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;
     DWORD windx, windy;
     UINT  WidthUnit, HeightUnit;
@@ -1767,7 +1869,7 @@ OnGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo)
 static VOID
 OnSize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
 {
 static VOID
 OnSize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
 
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
 
@@ -1872,7 +1974,7 @@ GuiConsoleHandleScrollbarMenu(VOID)
 static LRESULT
 OnScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam)
 {
 static LRESULT
 OnScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_SCREEN_BUFFER Buff;
     SCROLLINFO sInfo;
     int fnBar;
     PCONSOLE_SCREEN_BUFFER Buff;
     SCROLLINFO sInfo;
     int fnBar;
@@ -1983,7 +2085,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     LRESULT Result = 0;
     PGUI_CONSOLE_DATA GuiData = NULL;
 {
     LRESULT Result = 0;
     PGUI_CONSOLE_DATA GuiData = NULL;
-    PCONSOLE Console = NULL;
+    PCONSRV_CONSOLE Console = NULL;
 
     /*
      * - If it's the first time we create a window for the terminal,
 
     /*
      * - If it's the first time we create a window for the terminal,
index f6caa6d..dee5c32 100644 (file)
 #define PM_CONSOLE_BEEP         (WM_APP + 4)
 #define PM_CONSOLE_SET_TITLE    (WM_APP + 5)
 
 #define PM_CONSOLE_BEEP         (WM_APP + 4)
 #define PM_CONSOLE_SET_TITLE    (WM_APP + 5)
 
+/*
+typedef struct _CONSOLE_FONT
+{
+    HFONT Font;
+    ULONG Flag;
+} CONSOLE_FONT, *PCONSOLE_FONT;
+*/
+#define FONT_NORMAL     0x00
+#define FONT_BOLD       0x01
+#define FONT_UNDERLINE  0x02
+#define FONT_MAXNO      0x04
 
 typedef struct _GUI_CONSOLE_DATA
 {
 
 typedef struct _GUI_CONSOLE_DATA
 {
@@ -56,12 +67,12 @@ typedef struct _GUI_CONSOLE_DATA
 
 //  PVOID   ScreenBuffer;       /* Hardware screen buffer */
 
 
 //  PVOID   ScreenBuffer;       /* Hardware screen buffer */
 
-    HFONT Font;
-    UINT CharWidth;
-    UINT CharHeight;
+    HFONT Font[FONT_MAXNO];
+    UINT CharWidth;     /* The character width and height should be the same for */
+    UINT CharHeight;    /* both normal and bold/underlined fonts...              */
 /*****************************************************/
 
 /*****************************************************/
 
-    PCONSOLE Console;           /* Pointer to the owned console */
+    PCONSRV_CONSOLE Console;           /* Pointer to the owned console */
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to the active screen buffer (then maybe the previous Console member is redundant?? Or not...) */
     CONSOLE_SELECTION_INFO Selection;       /* Contains information about the selection */
     COORD dwSelectionCursor;                /* Selection cursor position, most of the time different from Selection.dwSelectionAnchor */
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to the active screen buffer (then maybe the previous Console member is redundant?? Or not...) */
     CONSOLE_SELECTION_INFO Selection;       /* Contains information about the selection */
     COORD dwSelectionCursor;                /* Selection cursor position, most of the time different from Selection.dwSelectionAnchor */
index caf9330..1bb4283 100644 (file)
@@ -48,7 +48,7 @@ LeaveFullScreen(PGUI_CONSOLE_DATA GuiData)
 VOID
 SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
 {
 VOID
 SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
 
     /*
      * See:
 
     /*
      * See:
@@ -174,7 +174,7 @@ SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen)
 VOID
 GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData)
 {
 VOID
 GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData)
 {
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     BOOL FullScreen;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
     BOOL FullScreen;
 
     if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
index 37111b3..ba1d6ff 100644 (file)
@@ -115,7 +115,7 @@ GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
      * This function supposes that the system clipboard was opened.
      */
 
      * This function supposes that the system clipboard was opened.
      */
 
-    // PCONSOLE Console = Buffer->Header.Console;
+    // PCONSRV_CONSOLE Console = Buffer->Header.Console;
 
     UNIMPLEMENTED;
 }
 
     UNIMPLEMENTED;
 }
@@ -126,7 +126,7 @@ GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
                        PRECT rcView,
                        PRECT rcFramebuffer)
 {
                        PRECT rcView,
                        PRECT rcFramebuffer)
 {
-    PCONSOLE Console = Buffer->Header.Console;
+    PCONSRV_CONSOLE Console = Buffer->Header.Console;
     // ASSERT(Console == GuiData->Console);
 
     if (Buffer->BitMap == NULL) return;
     // ASSERT(Console == GuiData->Console);
 
     if (Buffer->BitMap == NULL) return;
index a3969fe..12dce74 100644 (file)
@@ -17,9 +17,6 @@
 #include "guiterm.h"
 #include "guisettings.h"
 
 #include "guiterm.h"
 #include "guisettings.h"
 
-VOID GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData);
-VOID SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen);
-
 /* FUNCTIONS ******************************************************************/
 
 BOOL
 /* FUNCTIONS ******************************************************************/
 
 BOOL
@@ -199,14 +196,14 @@ GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
     // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE);
     // TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12
     // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16
     // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE);
     // TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12
     // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16
-    // TermInfo->FontWeight = FW_NORMAL;
 
     wcsncpy(TermInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
     // TermInfo->FaceName[0] = L'\0';
     TermInfo->FontFamily = FF_DONTCARE;
     TermInfo->FontSize.X = 0;
     TermInfo->FontSize.Y = 0;
 
     wcsncpy(TermInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
     // TermInfo->FaceName[0] = L'\0';
     TermInfo->FontFamily = FF_DONTCARE;
     TermInfo->FontSize.X = 0;
     TermInfo->FontSize.Y = 0;
-    TermInfo->FontWeight = FW_DONTCARE;
+    TermInfo->FontWeight = FW_NORMAL; // HACK: !!
+    // TermInfo->FontWeight = FW_DONTCARE;
 
     TermInfo->FullScreen   = FALSE;
     TermInfo->ShowWindow   = SW_SHOWNORMAL;
 
     TermInfo->FullScreen   = FALSE;
     TermInfo->ShowWindow   = SW_SHOWNORMAL;
@@ -230,7 +227,7 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData,
                                 BOOL Defaults)
 {
     NTSTATUS Status;
                                 BOOL Defaults)
 {
     NTSTATUS Status;
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL, hClientSection = NULL;
     PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL, hClientSection = NULL;
@@ -418,99 +415,13 @@ Quit:
     return;
 }
 
     return;
 }
 
-
-
-
-BOOL
-ChangeFont(PGUI_CONSOLE_DATA GuiData,
-           LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements.
-           ULONG  FontFamily,
-           COORD  FontSize,
-           ULONG  FontWeight)
-{
-    HDC hDC;
-    HFONT OldFont, NewFont;
-    TEXTMETRICW Metrics;
-    SIZE CharSize;
-    SIZE_T Length;
-
-    NewFont = CreateFontW(FontSize.Y,
-                          0, // FontSize.X,
-                          0,
-                          TA_BASELINE,
-                          FontWeight,
-                          FALSE,
-                          FALSE,
-                          FALSE,
-                          OEM_CHARSET,
-                          OUT_DEFAULT_PRECIS,
-                          CLIP_DEFAULT_PRECIS,
-                          NONANTIALIASED_QUALITY,
-                          FIXED_PITCH | FontFamily /* FF_DONTCARE */,
-                          FaceName);
-    if (NewFont == NULL)
-    {
-        DPRINT1("ChangeFont: CreateFont failed\n");
-        return FALSE;
-    }
-
-    hDC = GetDC(GuiData->hWindow);
-    if (hDC == NULL)
-    {
-        DPRINT1("ChangeFont: GetDC failed\n");
-        DeleteObject(NewFont);
-        return FALSE;
-    }
-
-    OldFont = SelectObject(hDC, NewFont);
-    if (OldFont == NULL)
-    {
-        DPRINT1("ChangeFont: SelectObject failed\n");
-        ReleaseDC(GuiData->hWindow, hDC);
-        DeleteObject(NewFont);
-        return FALSE;
-    }
-
-    if (!GetTextMetricsW(hDC, &Metrics))
-    {
-        DPRINT1("ChangeFont: GetTextMetrics failed\n");
-        SelectObject(hDC, OldFont);
-        ReleaseDC(GuiData->hWindow, hDC);
-        DeleteObject(NewFont);
-        return FALSE;
-    }
-    GuiData->CharWidth  = Metrics.tmMaxCharWidth;
-    GuiData->CharHeight = Metrics.tmHeight + Metrics.tmExternalLeading;
-
-    /* Measure real char width more precisely if possible. */
-    if (GetTextExtentPoint32W(hDC, L"R", 1, &CharSize))
-        GuiData->CharWidth = CharSize.cx;
-
-    SelectObject(hDC, OldFont);
-    ReleaseDC(GuiData->hWindow, hDC);
-
-    if (GuiData->Font != NULL) DeleteObject(GuiData->Font);
-    GuiData->Font = NewFont;
-
-    Length = min(wcslen(FaceName) + 1, LF_FACESIZE); // wcsnlen
-    wcsncpy(GuiData->GuiInfo.FaceName, FaceName, LF_FACESIZE);
-    GuiData->GuiInfo.FaceName[Length] = L'\0'; // NULL-terminate
-    GuiData->GuiInfo.FontFamily     = FontFamily;
-    GuiData->GuiInfo.FontSize       = FontSize;
-    GuiData->GuiInfo.FontWeight     = FontWeight;
-
-    return TRUE;
-}
-
-
-
 VOID
 GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
                      HANDLE hClientSection,
                      BOOL SaveSettings)
 {
     NTSTATUS Status = STATUS_SUCCESS;
 VOID
 GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
                      HANDLE hClientSection,
                      BOOL SaveSettings)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL;
     ULONG ViewSize = 0;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL;
     ULONG ViewSize = 0;
@@ -586,11 +497,11 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
             // memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO));
 
             /* Change the font */
             // memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO));
 
             /* Change the font */
-            ChangeFont(GuiData,
-                       GuiInfo->FaceName,
-                       GuiInfo->FontFamily,
-                       GuiInfo->FontSize,
-                       GuiInfo->FontWeight);
+            InitFonts(GuiData,
+                      GuiInfo->FaceName,
+                      GuiInfo->FontFamily,
+                      GuiInfo->FontSize,
+                      GuiInfo->FontWeight);
            // HACK, needed because changing font may change the size of the window
            /**/TermResizeTerminal(Console);/**/
 
            // HACK, needed because changing font may change the size of the window
            /**/TermResizeTerminal(Console);/**/
 
@@ -654,7 +565,7 @@ GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
                                HANDLE hClientSection)
 {
     NTSTATUS Status = STATUS_SUCCESS;
                                HANDLE hClientSection)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    PCONSOLE Console = GuiData->Console;
+    PCONSRV_CONSOLE Console = GuiData->Console;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL;
     ULONG ViewSize = 0;
     PCONSOLE_PROCESS_DATA ProcessData;
     HANDLE hSection = NULL;
     ULONG ViewSize = 0;
@@ -768,11 +679,11 @@ GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
             // memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
 
             /* Change the font */
             // memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
 
             /* Change the font */
-            ChangeFont(GuiData,
-                       GuiInfo.FaceName,
-                       GuiInfo.FontFamily,
-                       GuiInfo.FontSize,
-                       GuiInfo.FontWeight);
+            InitFonts(GuiData,
+                      GuiInfo.FaceName,
+                      GuiInfo.FontFamily,
+                      GuiInfo.FontSize,
+                      GuiInfo.FontWeight);
            // HACK, needed because changing font may change the size of the window
            /**/TermResizeTerminal(Console);/**/
 
            // HACK, needed because changing font may change the size of the window
            /**/TermResizeTerminal(Console);/**/
 
index df95bdc..593c14e 100644 (file)
@@ -29,7 +29,6 @@
 
 typedef struct _GUI_CONSOLE_INFO
 {
 
 typedef struct _GUI_CONSOLE_INFO
 {
-    // FONTSIGNATURE FontSignature;
     WCHAR FaceName[LF_FACESIZE];
     ULONG FontFamily;
     COORD FontSize;
     WCHAR FaceName[LF_FACESIZE];
     ULONG FontFamily;
     COORD FontSize;
index 8b6bc26..730d9a3 100644 (file)
@@ -160,7 +160,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
         case PM_CREATE_CONSOLE:
         {
             PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)lParam;
         case PM_CREATE_CONSOLE:
         {
             PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)lParam;
-            PCONSOLE Console = GuiData->Console;
+            PCONSRV_CONSOLE Console = GuiData->Console;
             RECT rcWnd;
 
             DPRINT("PM_CREATE_CONSOLE -- creating window\n");
             RECT rcWnd;
 
             DPRINT("PM_CREATE_CONSOLE -- creating window\n");
@@ -394,9 +394,9 @@ GuiInit(VOID)
 static VOID NTAPI
 GuiDeinitFrontEnd(IN OUT PFRONTEND This);
 
 static VOID NTAPI
 GuiDeinitFrontEnd(IN OUT PFRONTEND This);
 
-NTSTATUS NTAPI
+static NTSTATUS NTAPI
 GuiInitFrontEnd(IN OUT PFRONTEND This,
 GuiInitFrontEnd(IN OUT PFRONTEND This,
-                IN PCONSOLE Console)
+                IN PCONSRV_CONSOLE Console)
 {
     PGUI_INIT_INFO GuiInitInfo;
     PCONSOLE_INFO  ConsoleInfo;
 {
     PGUI_INIT_INFO GuiInitInfo;
     PCONSOLE_INFO  ConsoleInfo;
index b70efa9..8755cdd 100644 (file)
 #include "conwnd.h"
 
 NTSTATUS GuiInitConsole(PCONSOLE Console,
 #include "conwnd.h"
 
 NTSTATUS GuiInitConsole(PCONSOLE Console,
-                                 /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo,
-                                 PCONSOLE_INFO ConsoleInfo,
-                                 DWORD ProcessId,
-                                 LPCWSTR IconPath,
-                                 INT IconIndex);
+                        /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo,
+                        PCONSOLE_INFO ConsoleInfo,
+                        DWORD ProcessId,
+                        LPCWSTR IconPath,
+                        INT IconIndex);
+
+VOID
+GuiConsoleMoveWindow(PGUI_CONSOLE_DATA GuiData);
+
+VOID
+SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen);
+
+BOOL
+InitFonts(PGUI_CONSOLE_DATA GuiData,
+          LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements.
+          ULONG  FontFamily,
+          COORD  FontSize,
+          ULONG  FontWeight);
+VOID
+DeleteFonts(PGUI_CONSOLE_DATA GuiData);
index 50ebbb6..ba38aaa 100644 (file)
@@ -25,7 +25,7 @@
 /* FUNCTIONS ******************************************************************/
 
 static COLORREF
 /* FUNCTIONS ******************************************************************/
 
 static COLORREF
-PaletteRGBFromAttrib(PCONSOLE Console, WORD Attribute)
+PaletteRGBFromAttrib(PCONSRV_CONSOLE Console, WORD Attribute)
 {
     HPALETTE hPalette = Console->ActiveBuffer->PaletteHandle;
     PALETTEENTRY pe;
 {
     HPALETTE hPalette = Console->ActiveBuffer->PaletteHandle;
     PALETTEENTRY pe;
@@ -36,44 +36,6 @@ PaletteRGBFromAttrib(PCONSOLE Console, WORD Attribute)
     return PALETTERGB(pe.peRed, pe.peGreen, pe.peBlue);
 }
 
     return PALETTERGB(pe.peRed, pe.peGreen, pe.peBlue);
 }
 
-static HFONT
-ChangeFontAttributes(PGUI_CONSOLE_DATA GuiData,
-                     // COORD   FontSize,
-                     ULONG   FontWeight,
-                     BOOLEAN bItalic,
-                     BOOLEAN bUnderline,
-                     BOOLEAN bStrikeOut)
-{
-    HFONT NewFont;
-    LOGFONT lf;
-
-    /* Initialize the LOGFONT structure */
-    RtlZeroMemory(&lf, sizeof(lf));
-
-    /* Retrieve the details of the current font */
-    if (GetObject(GuiData->Font, sizeof(lf), &lf) == 0)
-        return NULL; // GuiData->Font;
-
-    /* Change the font attributes */
-    // lf.lfHeight = FontSize.Y;
-    // lf.lfWidth  = FontSize.X;
-    lf.lfWeight = FontWeight;
-    lf.lfItalic = bItalic;
-    lf.lfUnderline = bUnderline;
-    lf.lfStrikeOut = bStrikeOut;
-
-    /* Build a new font */
-    NewFont = CreateFontIndirect(&lf);
-    if (NewFont == NULL)
-        return NULL; // GuiData->Font;
-
-    // FIXME: Do we need to update GuiData->CharWidth and GuiData->CharHeight ??
-
-    /* Select it (return the old font) */
-    // return SelectObject(GuiData->hMemDC, NewFont);
-    return NewFont;
-}
-
 static VOID
 CopyBlock(PTEXTMODE_SCREEN_BUFFER Buffer,
           PSMALL_RECT Selection)
 static VOID
 CopyBlock(PTEXTMODE_SCREEN_BUFFER Buffer,
           PSMALL_RECT Selection)
@@ -309,7 +271,7 @@ GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
      * This function supposes that the system clipboard was opened.
      */
 
      * This function supposes that the system clipboard was opened.
      */
 
-    PCONSOLE Console = Buffer->Header.Console;
+    PCONSRV_CONSOLE Console = Buffer->Header.Console;
 
     HANDLE hData;
     LPWSTR str;
 
     HANDLE hData;
     LPWSTR str;
@@ -377,7 +339,7 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
                        PRECT rcView,
                        PRECT rcFramebuffer)
 {
                        PRECT rcView,
                        PRECT rcFramebuffer)
 {
-    PCONSOLE Console = Buffer->Header.Console;
+    PCONSRV_CONSOLE Console = Buffer->Header.Console;
     // ASSERT(Console == GuiData->Console);
 
     ULONG TopLine, BottomLine, LeftChar, RightChar;
     // ASSERT(Console == GuiData->Console);
 
     ULONG TopLine, BottomLine, LeftChar, RightChar;
@@ -388,7 +350,7 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
     ULONG CursorX, CursorY, CursorHeight;
     HBRUSH CursorBrush, OldBrush;
     HFONT OldFont, NewFont;
     ULONG CursorX, CursorY, CursorHeight;
     HBRUSH CursorBrush, OldBrush;
     HFONT OldFont, NewFont;
-    BOOLEAN IsUnderscore;
+    BOOLEAN IsUnderline;
 
     if (Buffer->Buffer == NULL) return;
 
 
     if (Buffer->Buffer == NULL) return;
 
@@ -412,17 +374,10 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
     SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute)));
     SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute)));
 
     SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute)));
     SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute)));
 
-    // OldFont = ChangeFontAttributes(GuiData, /* {0}, */ GuiData->GuiInfo.FontWeight, FALSE, FALSE, FALSE);
-    IsUnderscore = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
-    NewFont = ChangeFontAttributes(GuiData, /* {0}, */ GuiData->GuiInfo.FontWeight,
-                                   FALSE,
-                                   IsUnderscore,
-                                   FALSE);
-    if (NewFont == NULL)
-    {
-        DPRINT1("ChangeFontAttributes failed, use the original font\n");
-        NewFont = GuiData->Font;
-    }
+    /* We use the underscore flag as a underline flag */
+    IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
+    /* Select the new font */
+    NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
     OldFont = SelectObject(GuiData->hMemDC, NewFont);
 
     for (Line = TopLine; Line <= BottomLine; Line++)
     OldFont = SelectObject(GuiData->hMemDC, NewFont);
 
     for (Line = TopLine; Line <= BottomLine; Line++)
@@ -454,25 +409,12 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
                     SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute)));
                     SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute)));
 
                     SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute)));
                     SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute)));
 
-                    /* Change underscore state if needed */
-                    if (!!(LastAttribute & COMMON_LVB_UNDERSCORE) != IsUnderscore)
+                    /* Change underline state if needed */
+                    if (!!(LastAttribute & COMMON_LVB_UNDERSCORE) != IsUnderline)
                     {
                     {
-                        IsUnderscore = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
-
-                        /* Delete the font we used up to now */
-                        // SelectObject(GuiData->hMemDC, OldFont);
-                        if (NewFont != GuiData->Font) DeleteObject(NewFont);
-                        /* Recreate it */
-                        NewFont = ChangeFontAttributes(GuiData, /* {0}, */ GuiData->GuiInfo.FontWeight,
-                                                       FALSE,
-                                                       IsUnderscore,
-                                                       FALSE);
-                        if (NewFont == NULL)
-                        {
-                            DPRINT1("ChangeFontAttributes failed, use the original font\n");
-                            NewFont = GuiData->Font;
-                        }
-                        /* Select it */
+                        IsUnderline = !!(LastAttribute & COMMON_LVB_UNDERSCORE);
+                        /* Select the new font */
+                        NewFont = GuiData->Font[IsUnderline ? FONT_BOLD : FONT_NORMAL];
                         /* OldFont = */ SelectObject(GuiData->hMemDC, NewFont);
                     }
                 }
                         /* OldFont = */ SelectObject(GuiData->hMemDC, NewFont);
                     }
                 }
@@ -488,6 +430,9 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
                  RightChar - Start + 1);
     }
 
                  RightChar - Start + 1);
     }
 
+    /* Restore the old font */
+    SelectObject(GuiData->hMemDC, OldFont);
+
     /*
      * Draw the caret
      */
     /*
      * Draw the caret
      */
@@ -520,10 +465,6 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
         }
     }
 
         }
     }
 
-    /* Restore the old font and delete the font we used up to now */
-    SelectObject(GuiData->hMemDC, OldFont);
-    if (NewFont != GuiData->Font) DeleteObject(NewFont);
-
     LeaveCriticalSection(&Console->Lock);
 }
 
     LeaveCriticalSection(&Console->Lock);
 }
 
index 2fb6f3b..b2c1704 100644 (file)
@@ -126,7 +126,7 @@ ConioGetShiftState(PBYTE KeyState, LPARAM lParam)
 }
 
 VOID NTAPI
 }
 
 VOID NTAPI
-ConioProcessKey(PCONSOLE Console, MSG* msg)
+ConioProcessKey(PCONSRV_CONSOLE Console, MSG* msg)
 {
     static BYTE KeyState[256] = { 0 };
     /* MSDN mentions that you should use the last virtual key code received
 {
     static BYTE KeyState[256] = { 0 };
     /* MSDN mentions that you should use the last virtual key code received
@@ -205,7 +205,7 @@ ConioProcessKey(PCONSOLE Console, MSG* msg)
 }
 
 DWORD
 }
 
 DWORD
-ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale)
+ConioEffectiveCursorSize(PCONSRV_CONSOLE Console, DWORD Scale)
 {
     DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
     /* If line input in progress, perhaps adjust for insert toggle */
 {
     DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
     /* If line input in progress, perhaps adjust for insert toggle */
index 1231148..3e2bed7 100644 (file)
@@ -35,7 +35,7 @@ typedef struct _TUI_CONSOLE_DATA
 
     HWND hWindow;               /* Handle to the console's window (used for the window's procedure */
 
 
     HWND hWindow;               /* Handle to the console's window (used for the window's procedure */
 
-    PCONSOLE Console;           /* Pointer to the owned console */
+    PCONSRV_CONSOLE Console;           /* Pointer to the owned console */
     // TUI_CONSOLE_INFO TuiInfo;   /* TUI terminal settings */
 } TUI_CONSOLE_DATA, *PTUI_CONSOLE_DATA;
 
     // TUI_CONSOLE_INFO TuiInfo;   /* TUI terminal settings */
 } TUI_CONSOLE_DATA, *PTUI_CONSOLE_DATA;
 
@@ -261,7 +261,7 @@ TuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 /*
     PTUI_CONSOLE_DATA TuiData = NULL;
 {
 /*
     PTUI_CONSOLE_DATA TuiData = NULL;
-    PCONSOLE Console = NULL;
+    PCONSRV_CONSOLE Console = NULL;
 
     TuiData = TuiGetGuiData(hWnd);
     if (TuiData == NULL) return 0;
 
     TuiData = TuiGetGuiData(hWnd);
     if (TuiData == NULL) return 0;
@@ -330,7 +330,7 @@ static DWORD NTAPI
 TuiConsoleThread(PVOID Data)
 {
     PTUI_CONSOLE_DATA TuiData = (PTUI_CONSOLE_DATA)Data;
 TuiConsoleThread(PVOID Data)
 {
     PTUI_CONSOLE_DATA TuiData = (PTUI_CONSOLE_DATA)Data;
-    PCONSOLE Console = TuiData->Console;
+    PCONSRV_CONSOLE Console = TuiData->Console;
     HWND NewWindow;
     MSG msg;
 
     HWND NewWindow;
     MSG msg;
 
@@ -458,11 +458,11 @@ Quit:
 
 static VOID NTAPI
 TuiDeinitFrontEnd(IN OUT PFRONTEND This /*,
 
 static VOID NTAPI
 TuiDeinitFrontEnd(IN OUT PFRONTEND This /*,
-                  IN PCONSOLE Console */);
+                  IN PCONSRV_CONSOLE Console */);
 
 
-NTSTATUS NTAPI
+static NTSTATUS NTAPI
 TuiInitFrontEnd(IN OUT PFRONTEND This,
 TuiInitFrontEnd(IN OUT PFRONTEND This,
-                IN PCONSOLE Console)
+                IN PCONSRV_CONSOLE Console)
 {
     PTUI_CONSOLE_DATA TuiData;
     HANDLE ThreadHandle;
 {
     PTUI_CONSOLE_DATA TuiData;
     HANDLE ThreadHandle;
@@ -539,7 +539,7 @@ TuiInitFrontEnd(IN OUT PFRONTEND This,
 static VOID NTAPI
 TuiDeinitFrontEnd(IN OUT PFRONTEND This)
 {
 static VOID NTAPI
 TuiDeinitFrontEnd(IN OUT PFRONTEND This)
 {
-    // PCONSOLE Console = This->Console;
+    // PCONSRV_CONSOLE Console = This->Console;
     PTUI_CONSOLE_DATA TuiData = This->Data; // Console->FrontEndIFace.Data;
 
     /* Close the notification window */
     PTUI_CONSOLE_DATA TuiData = This->Data; // Console->FrontEndIFace.Data;
 
     /* Close the notification window */
index 2a176dc..84be2f7 100644 (file)
@@ -12,8 +12,8 @@
 #pragma once
 
 NTSTATUS TuiInitConsole(PCONSOLE Console,
 #pragma once
 
 NTSTATUS TuiInitConsole(PCONSOLE Console,
-                                 /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo,
-                                 PCONSOLE_INFO ConsoleInfo,
-                                 DWORD ProcessId);
+                        /*IN*/ PCONSOLE_START_INFO ConsoleStartInfo,
+                        PCONSOLE_INFO ConsoleInfo,
+                        DWORD ProcessId);
 
 /* EOF */
 
 /* EOF */
index a114411..4c74ab1 100644 (file)
@@ -482,7 +482,7 @@ ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
 {
     NTSTATUS Status = STATUS_SUCCESS;
     HANDLE ConsoleHandle;
 {
     NTSTATUS Status = STATUS_SUCCESS;
     HANDLE ConsoleHandle;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     /*
      * We are about to create a new console. However when ConSrvNewProcess
 
     /*
      * We are about to create a new console. However when ConSrvNewProcess
index 8d3dc9f..fc9d4eb 100644 (file)
 
 #include "rect.h"
 
 
 #include "rect.h"
 
-#define CSR_DEFAULT_CURSOR_SIZE 25
-
 /* Default attributes */
 #define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
 #define DEFAULT_POPUP_ATTRIB    (FOREGROUND_BLUE | FOREGROUND_RED   | \
                                  BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
 
 /* Default attributes */
 #define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
 #define DEFAULT_POPUP_ATTRIB    (FOREGROUND_BLUE | FOREGROUND_RED   | \
                                  BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
 
-/* VGA character cell */
-typedef struct _CHAR_CELL
-{
-    CHAR Char;
-    BYTE Attributes;
-} CHAR_CELL, *PCHAR_CELL;
-C_ASSERT(sizeof(CHAR_CELL) == 2);
-
 
 /* Object type magic numbers */
 typedef enum _CONSOLE_IO_OBJECT_TYPE
 
 /* Object type magic numbers */
 typedef enum _CONSOLE_IO_OBJECT_TYPE
@@ -272,7 +262,6 @@ typedef enum _CONSOLE_STATE
 
 // HACK!!
 struct _CONSOLE;
 
 // HACK!!
 struct _CONSOLE;
-struct _WINSRV_CONSOLE;
 /* HACK: */ typedef struct _CONSOLE *PCONSOLE;
 #include "conio_winsrv.h"
 
 /* HACK: */ typedef struct _CONSOLE *PCONSOLE;
 #include "conio_winsrv.h"
 
@@ -294,7 +283,7 @@ typedef struct _CONSOLE
     CONSOLE_INPUT_BUFFER InputBuffer;       /* Input buffer of the console */
     UINT InputCodePage;
 
     CONSOLE_INPUT_BUFFER InputBuffer;       /* Input buffer of the console */
     UINT InputCodePage;
 
-    /** Put those things in CONSOLE_INPUT_BUFFER ?? **/
+    /** Put those things in CONSOLE_INPUT_BUFFER in PWINSRV_CONSOLE ?? **/
     PWCHAR  LineBuffer;                     /* Current line being input, in line buffered mode */
     ULONG   LineMaxSize;                    /* Maximum size of line in characters (including CR+LF) */
     ULONG   LineSize;                       /* Current size of line */
     PWCHAR  LineBuffer;                     /* Current line being input, in line buffered mode */
     ULONG   LineMaxSize;                    /* Maximum size of line in characters (including CR+LF) */
     ULONG   LineSize;                       /* Current size of line */
@@ -303,26 +292,16 @@ typedef struct _CONSOLE
     BOOLEAN LineUpPressed;
     BOOLEAN LineInsertToggle;               /* Replace character over cursor instead of inserting */
     ULONG   LineWakeupMask;                 /* Bitmap of which control characters will end line input */
     BOOLEAN LineUpPressed;
     BOOLEAN LineInsertToggle;               /* Replace character over cursor instead of inserting */
     ULONG   LineWakeupMask;                 /* Bitmap of which control characters will end line input */
-    /*************************************************/
 
 
+    /** In PWINSRV_CONSOLE ?? **/
     BOOLEAN InsertMode;
     BOOLEAN InsertMode;
+    /*************************************************/
 
 /******************************* Screen buffers *******************************/
     LIST_ENTRY BufferList;                  /* List of all screen buffers for this console */
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to currently active screen buffer */
     UINT OutputCodePage;
 
 
 /******************************* Screen buffers *******************************/
     LIST_ENTRY BufferList;                  /* List of all screen buffers for this console */
     PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to currently active screen buffer */
     UINT OutputCodePage;
 
-    /**** Per-console Virtual DOS Machine Text-mode Buffer ****/
-    COORD   VDMBufferSize;             /* Real size of the VDM buffer, in units of ??? */
-    HANDLE  VDMBufferSection;          /* Handle to the memory shared section for the VDM buffer */
-    PVOID   VDMBuffer;                 /* Our VDM buffer */
-    PVOID   ClientVDMBuffer;           /* A copy of the client view of our VDM buffer */
-    HANDLE  VDMClientProcess;          /* Handle to the client process who opened the buffer, to unmap the view */
-
-    HANDLE StartHardwareEvent;
-    HANDLE EndHardwareEvent;
-    HANDLE ErrorHardwareEvent;
-
 /****************************** Other properties ******************************/
     UNICODE_STRING OriginalTitle;           /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
     UNICODE_STRING Title;                   /* Title of console. Always NULL-terminated */
 /****************************** Other properties ******************************/
     UNICODE_STRING OriginalTitle;           /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
     UNICODE_STRING Title;                   /* Title of console. Always NULL-terminated */
@@ -332,30 +311,19 @@ typedef struct _CONSOLE
     COORD   ConsoleSize;                    /* The current size of the console, for text-mode only */
     BOOLEAN FixedSize;                      /* TRUE if the console is of fixed size */
 
     COORD   ConsoleSize;                    /* The current size of the console, for text-mode only */
     BOOLEAN FixedSize;                      /* TRUE if the console is of fixed size */
 
-    COLORREF Colors[16];                    /* Colour palette */
-
 } CONSOLE; // , *PCONSOLE;
 
 } CONSOLE; // , *PCONSOLE;
 
-// #include "conio_winsrv.h"
-
 /* console.c */
 VOID NTAPI
 ConDrvPause(PCONSOLE Console);
 VOID NTAPI
 ConDrvUnpause(PCONSOLE Console);
 
 /* console.c */
 VOID NTAPI
 ConDrvPause(PCONSOLE Console);
 VOID NTAPI
 ConDrvUnpause(PCONSOLE Console);
 
-PCONSOLE_PROCESS_DATA NTAPI
-ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console);
 NTSTATUS
 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
                        IN PCONSOLE_PROCESS_DATA ProcessData);
 NTSTATUS
 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
                        IN PCONSOLE_PROCESS_DATA ProcessData);
-NTSTATUS NTAPI
-ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
-                              IN ULONG ProcessGroupId,
-                              IN ULONG CtrlEvent);
 
 /* coninput.c */
 
 /* coninput.c */
-VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
 NTSTATUS
 ConioAddInputEvents(PCONSOLE Console,
                     PINPUT_RECORD InputRecords,
 NTSTATUS
 ConioAddInputEvents(PCONSOLE Console,
                     PINPUT_RECORD InputRecords,
@@ -392,7 +360,5 @@ NTSTATUS ConioWriteConsole(PCONSOLE Console,
                            PWCHAR Buffer,
                            DWORD Length,
                            BOOL Attrib);
                            PWCHAR Buffer,
                            DWORD Length,
                            BOOL Attrib);
-DWORD ConioEffectiveCursorSize(PCONSOLE Console,
-                                        DWORD Scale);
 
 /* EOF */
 
 /* EOF */
index 4669dae..d7be50e 100644 (file)
 
 #include "rect.h"
 
 
 #include "rect.h"
 
+// This is ALMOST a HACK!!!!!!!
+// Helpers for code refactoring
+#define _CONSRV_CONSOLE  _CONSOLE
+#define  CONSRV_CONSOLE   CONSOLE
+#define PCONSRV_CONSOLE  PCONSOLE
+
+// #define _CONSRV_CONSOLE  _WINSRV_CONSOLE
+// #define  CONSRV_CONSOLE   WINSRV_CONSOLE
+// #define PCONSRV_CONSOLE  PWINSRV_CONSOLE
+
+
 #define CSR_DEFAULT_CURSOR_SIZE 25
 
 #define CSR_DEFAULT_CURSOR_SIZE 25
 
+/* VGA character cell */
+typedef struct _CHAR_CELL
+{
+    CHAR Char;
+    BYTE Attributes;
+} CHAR_CELL, *PCHAR_CELL;
+C_ASSERT(sizeof(CHAR_CELL) == 2);
+
+
 typedef struct _FRONTEND FRONTEND, *PFRONTEND;
 /* HACK: */ typedef struct _CONSOLE_INFO *PCONSOLE_INFO;
 typedef struct _FRONTEND_VTBL
 typedef struct _FRONTEND FRONTEND, *PFRONTEND;
 /* HACK: */ typedef struct _CONSOLE_INFO *PCONSOLE_INFO;
 typedef struct _FRONTEND_VTBL
@@ -24,7 +44,7 @@ typedef struct _FRONTEND_VTBL
      * Internal interface (functions called by the console server only)
      */
     NTSTATUS (NTAPI *InitFrontEnd)(IN OUT PFRONTEND This,
      * Internal interface (functions called by the console server only)
      */
     NTSTATUS (NTAPI *InitFrontEnd)(IN OUT PFRONTEND This,
-                                   IN struct _CONSOLE* Console);
+                                   IN struct _CONSRV_CONSOLE* Console);
     VOID (NTAPI *DeinitFrontEnd)(IN OUT PFRONTEND This);
 
     /* Interface used for both text-mode and graphics screen buffers */
     VOID (NTAPI *DeinitFrontEnd)(IN OUT PFRONTEND This);
 
     /* Interface used for both text-mode and graphics screen buffers */
@@ -83,8 +103,7 @@ struct _FRONTEND
     PFRONTEND_VTBL Vtbl;        /* Virtual table */
     NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
 
     PFRONTEND_VTBL Vtbl;        /* Virtual table */
     NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
 
-    // struct _WINSRV_CONSOLE*
-    struct _CONSOLE* Console;   /* Console to which the frontend is attached to */
+    struct _CONSRV_CONSOLE* Console;   /* Console to which the frontend is attached to */
     PVOID Data;                 /* Private data  */
     PVOID OldData;              /* Reserved      */
 };
     PVOID Data;                 /* Private data  */
     PVOID OldData;              /* Reserved      */
 };
@@ -99,6 +118,7 @@ typedef struct _WINSRV_CONSOLE
 /******************************* Console Set-up *******************************/
     /* This **MUST** be FIRST!! */
     // CONSOLE;
 /******************************* Console Set-up *******************************/
     /* This **MUST** be FIRST!! */
     // CONSOLE;
+    // PCONSOLE Console;
 
     // LONG ReferenceCount;                    /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
     // CRITICAL_SECTION Lock;
 
     // LONG ReferenceCount;                    /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
     // CRITICAL_SECTION Lock;
@@ -125,35 +145,49 @@ typedef struct _WINSRV_CONSOLE
     ULONG NumberOfHistoryBuffers;           /* Maximum number of history buffers allowed */
     BOOLEAN HistoryNoDup;                   /* Remove old duplicate history entries */
 
     ULONG NumberOfHistoryBuffers;           /* Maximum number of history buffers allowed */
     BOOLEAN HistoryNoDup;                   /* Remove old duplicate history entries */
 
+/************************ Virtual DOS Machine support *************************/
+    COORD   VDMBufferSize;             /* Real size of the VDM buffer, in units of ??? */
+    HANDLE  VDMBufferSection;          /* Handle to the memory shared section for the VDM buffer */
+    PVOID   VDMBuffer;                 /* Our VDM buffer */
+    PVOID   ClientVDMBuffer;           /* A copy of the client view of our VDM buffer */
+    HANDLE  VDMClientProcess;          /* Handle to the client process who opened the buffer, to unmap the view */
+
+    HANDLE StartHardwareEvent;
+    HANDLE EndHardwareEvent;
+    HANDLE ErrorHardwareEvent;
+
+/****************************** Other properties ******************************/
+    COLORREF Colors[16];                    /* Colour palette */
+
 } WINSRV_CONSOLE, *PWINSRV_CONSOLE;
 
 /* console.c */
 } WINSRV_CONSOLE, *PWINSRV_CONSOLE;
 
 /* console.c */
-VOID ConioPause(PCONSOLE Console, UINT Flags);
-VOID ConioUnpause(PCONSOLE Console, UINT Flags);
+VOID ConioPause(PCONSRV_CONSOLE Console, UINT Flags);
+VOID ConioUnpause(PCONSRV_CONSOLE Console, UINT Flags);
 
 PCONSOLE_PROCESS_DATA NTAPI
 
 PCONSOLE_PROCESS_DATA NTAPI
-ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console);
+ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console);
 NTSTATUS
 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
                        IN PCONSOLE_PROCESS_DATA ProcessData);
 NTSTATUS NTAPI
 NTSTATUS
 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
                        IN PCONSOLE_PROCESS_DATA ProcessData);
 NTSTATUS NTAPI
-ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
+ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console,
                               IN ULONG ProcessGroupId,
                               IN ULONG CtrlEvent);
 
 /* coninput.c */
                               IN ULONG ProcessGroupId,
                               IN ULONG CtrlEvent);
 
 /* coninput.c */
-VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
-DWORD ConioEffectiveCursorSize(PCONSOLE Console,
+VOID NTAPI ConioProcessKey(PCONSRV_CONSOLE Console, MSG* msg);
+DWORD ConioEffectiveCursorSize(PCONSRV_CONSOLE Console,
                                DWORD Scale);
 
 NTSTATUS
                                DWORD Scale);
 
 NTSTATUS
-ConioAddInputEvents(PCONSOLE Console,
+ConioAddInputEvents(PCONSRV_CONSOLE Console,
                     PINPUT_RECORD InputRecords,
                     ULONG NumEventsToWrite,
                     PULONG NumEventsWritten,
                     BOOLEAN AppendToEnd);
 NTSTATUS
                     PINPUT_RECORD InputRecords,
                     ULONG NumEventsToWrite,
                     PULONG NumEventsWritten,
                     BOOLEAN AppendToEnd);
 NTSTATUS
-ConioProcessInputEvent(PCONSOLE Console,
+ConioProcessInputEvent(PCONSRV_CONSOLE Console,
                        PINPUT_RECORD InputEvent);
 
 /* conoutput.c */
                        PINPUT_RECORD InputEvent);
 
 /* conoutput.c */
@@ -173,11 +207,11 @@ ConioProcessInputEvent(PCONSOLE Console,
     MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
 
 PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
     MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
 
 PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
-VOID ConioDrawConsole(PCONSOLE Console);
-NTSTATUS ConioResizeBuffer(PCONSOLE Console,
+VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
+NTSTATUS ConioResizeBuffer(PCONSRV_CONSOLE Console,
                            PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
                            COORD Size);
                            PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
                            COORD Size);
-NTSTATUS ConioWriteConsole(PCONSOLE Console,
+NTSTATUS ConioWriteConsole(PCONSRV_CONSOLE Console,
                            PTEXTMODE_SCREEN_BUFFER Buff,
                            PWCHAR Buffer,
                            DWORD Length,
                            PTEXTMODE_SCREEN_BUFFER Buff,
                            PWCHAR Buffer,
                            DWORD Length,
index c3ae65e..e60ff4c 100644 (file)
@@ -43,7 +43,7 @@ ConvertInputUnicodeToAnsi(PCONSOLE Console,
 /* PRIVATE FUNCTIONS **********************************************************/
 
 static PHISTORY_BUFFER
 /* PRIVATE FUNCTIONS **********************************************************/
 
 static PHISTORY_BUFFER
-HistoryCurrentBuffer(PCONSOLE Console,
+HistoryCurrentBuffer(PCONSRV_CONSOLE Console,
                      PUNICODE_STRING ExeName)
 {
     PLIST_ENTRY Entry = Console->HistoryBuffers.Flink;
                      PUNICODE_STRING ExeName)
 {
     PLIST_ENTRY Entry = Console->HistoryBuffers.Flink;
@@ -75,7 +75,7 @@ HistoryCurrentBuffer(PCONSOLE Console,
 }
 
 static VOID
 }
 
 static VOID
-HistoryAddEntry(PCONSOLE Console,
+HistoryAddEntry(PCONSRV_CONSOLE Console,
                 PUNICODE_STRING ExeName)
 {
     UNICODE_STRING NewEntry;
                 PUNICODE_STRING ExeName)
 {
     UNICODE_STRING NewEntry;
@@ -127,7 +127,7 @@ HistoryAddEntry(PCONSOLE Console,
 }
 
 static VOID
 }
 
 static VOID
-HistoryGetCurrentEntry(PCONSOLE Console,
+HistoryGetCurrentEntry(PCONSRV_CONSOLE Console,
                        PUNICODE_STRING ExeName,
                        PUNICODE_STRING Entry)
 {
                        PUNICODE_STRING ExeName,
                        PUNICODE_STRING Entry)
 {
@@ -140,7 +140,7 @@ HistoryGetCurrentEntry(PCONSOLE Console,
 }
 
 static PHISTORY_BUFFER
 }
 
 static PHISTORY_BUFFER
-HistoryFindBuffer(PCONSOLE Console,
+HistoryFindBuffer(PCONSRV_CONSOLE Console,
                   PVOID    ExeName,
                   USHORT   ExeLength,
                   BOOLEAN  UnicodeExe)
                   PVOID    ExeName,
                   USHORT   ExeLength,
                   BOOLEAN  UnicodeExe)
@@ -202,7 +202,7 @@ HistoryDeleteBuffer(PHISTORY_BUFFER Hist)
 }
 
 VOID
 }
 
 VOID
-HistoryDeleteBuffers(PCONSOLE Console)
+HistoryDeleteBuffers(PCONSRV_CONSOLE Console)
 {
     PLIST_ENTRY CurrentEntry;
     PHISTORY_BUFFER HistoryBuffer;
 {
     PLIST_ENTRY CurrentEntry;
     PHISTORY_BUFFER HistoryBuffer;
@@ -216,7 +216,7 @@ HistoryDeleteBuffers(PCONSOLE Console)
 }
 
 static VOID
 }
 
 static VOID
-LineInputSetPos(PCONSOLE Console, UINT Pos)
+LineInputSetPos(PCONSRV_CONSOLE Console, UINT Pos)
 {
     if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT)
     {
 {
     if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT)
     {
@@ -240,7 +240,7 @@ LineInputSetPos(PCONSOLE Console, UINT Pos)
 }
 
 static VOID
 }
 
 static VOID
-LineInputEdit(PCONSOLE Console, UINT NumToDelete, UINT NumToInsert, PWCHAR Insertion)
+LineInputEdit(PCONSRV_CONSOLE Console, UINT NumToDelete, UINT NumToInsert, PWCHAR Insertion)
 {
     PTEXTMODE_SCREEN_BUFFER ActiveBuffer;
     UINT Pos = Console->LinePos;
 {
     PTEXTMODE_SCREEN_BUFFER ActiveBuffer;
     UINT Pos = Console->LinePos;
@@ -277,7 +277,7 @@ LineInputEdit(PCONSOLE Console, UINT NumToDelete, UINT NumToInsert, PWCHAR Inser
 }
 
 static VOID
 }
 
 static VOID
-LineInputRecallHistory(PCONSOLE Console,
+LineInputRecallHistory(PCONSRV_CONSOLE Console,
                        PUNICODE_STRING ExeName,
                        INT Offset)
 {
                        PUNICODE_STRING ExeName,
                        INT Offset)
 {
@@ -297,7 +297,7 @@ LineInputRecallHistory(PCONSOLE Console,
 }
 
 VOID
 }
 
 VOID
-LineInputKeyDown(PCONSOLE Console,
+LineInputKeyDown(PCONSRV_CONSOLE Console,
                  PUNICODE_STRING ExeName,
                  KEY_EVENT_RECORD *KeyEvent)
 {
                  PUNICODE_STRING ExeName,
                  KEY_EVENT_RECORD *KeyEvent)
 {
@@ -511,7 +511,7 @@ CSR_API(SrvGetConsoleCommandHistory)
 {
     NTSTATUS Status;
     PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     ULONG BytesWritten = 0;
     PHISTORY_BUFFER Hist;
 
     ULONG BytesWritten = 0;
     PHISTORY_BUFFER Hist;
 
@@ -599,7 +599,7 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
 {
     NTSTATUS Status;
     PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLengthRequest;
 {
     NTSTATUS Status;
     PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLengthRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PHISTORY_BUFFER Hist;
     ULONG Length = 0;
     UINT  i;
     PHISTORY_BUFFER Hist;
     ULONG Length = 0;
     UINT  i;
@@ -641,7 +641,7 @@ CSR_API(SrvExpungeConsoleCommandHistory)
 {
     NTSTATUS Status;
     PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ExpungeCommandHistoryRequest;
 {
     NTSTATUS Status;
     PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ExpungeCommandHistoryRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PHISTORY_BUFFER Hist;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
     PHISTORY_BUFFER Hist;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
@@ -669,7 +669,7 @@ CSR_API(SrvSetConsoleNumberOfCommands)
 {
     NTSTATUS Status;
     PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryNumberCommandsRequest;
 {
     NTSTATUS Status;
     PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryNumberCommandsRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     PHISTORY_BUFFER Hist;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
     PHISTORY_BUFFER Hist;
 
     if (!CsrValidateMessageBuffer(ApiMessage,
@@ -720,7 +720,7 @@ CSR_API(SrvGetConsoleHistory)
 {
 #if 0 // Vista+
     PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
 {
 #if 0 // Vista+
     PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (NT_SUCCESS(Status))
     {
     NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (NT_SUCCESS(Status))
     {
@@ -740,7 +740,7 @@ CSR_API(SrvSetConsoleHistory)
 {
 #if 0 // Vista+
     PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
 {
 #if 0 // Vista+
     PCONSOLE_GETSETHISTORYINFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
     NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (NT_SUCCESS(Status))
     {
     NTSTATUS Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
     if (NT_SUCCESS(Status))
     {
@@ -760,7 +760,7 @@ CSR_API(SrvSetConsoleCommandHistoryMode)
 {
     NTSTATUS Status;
     PCONSOLE_SETHISTORYMODE SetHistoryModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryModeRequest;
 {
     NTSTATUS Status;
     PCONSOLE_SETHISTORYMODE SetHistoryModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryModeRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     DPRINT1("SrvSetConsoleCommandHistoryMode(Mode = %d) is not yet implemented\n",
             SetHistoryModeRequest->Mode);
 
     DPRINT1("SrvSetConsoleCommandHistoryMode(Mode = %d) is not yet implemented\n",
             SetHistoryModeRequest->Mode);
index afb6d25..55511a0 100644 (file)
@@ -8,9 +8,9 @@
 
 #pragma once
 
 
 #pragma once
 
-VOID HistoryDeleteBuffers(PCONSOLE Console);
+VOID HistoryDeleteBuffers(PCONSRV_CONSOLE Console);
 
 VOID
 
 VOID
-LineInputKeyDown(PCONSOLE Console,
+LineInputKeyDown(PCONSRV_CONSOLE Console,
                  PUNICODE_STRING ExeName,
                  KEY_EVENT_RECORD *KeyEvent);
                  PUNICODE_STRING ExeName,
                  KEY_EVENT_RECORD *KeyEvent);
index 40f9740..e49f06e 100644 (file)
@@ -23,7 +23,7 @@ CSR_API(SrvRegisterConsoleVDM)
 {
     NTSTATUS Status;
     PCONSOLE_REGISTERVDM RegisterVDMRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.RegisterVDMRequest;
 {
     NTSTATUS Status;
     PCONSOLE_REGISTERVDM RegisterVDMRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.RegisterVDMRequest;
-    PCONSOLE Console;
+    PCONSRV_CONSOLE Console;
 
     DPRINT1("SrvRegisterConsoleVDM(%d)\n", RegisterVDMRequest->RegisterFlags);
 
 
     DPRINT1("SrvRegisterConsoleVDM(%d)\n", RegisterVDMRequest->RegisterFlags);