Compare commits

...

10 Commits

Author SHA1 Message Date
Amine Khaldi
2caf488e19 [0.4.4] Update the release type.
svn path=/branches/ros-branch-0_4_4/; revision=73800
2017-02-14 11:08:16 +00:00
Thomas Faber
1c5b0e88f2 [0.4.4]
- Mask WndProc exceptions
CORE-11915

svn path=/branches/ros-branch-0_4_4/; revision=73631
2017-01-30 11:35:05 +00:00
Amine Khaldi
972c5587ad [0.4.4] * Revert revisions 72835 and 72839 to avoid the FsRtlIsNameInExpressionPrivate crash from CORE-12121.
svn path=/branches/ros-branch-0_4_4/; revision=73630
2017-01-29 23:03:34 +00:00
Amine Khaldi
fd23640e43 [0.4.4] Revert some shell32 work (revisions 73436, 73591 and 73599) on Giannis request to avoid any potential last minute regressions. CORE-12700
svn path=/branches/ros-branch-0_4_4/; revision=73629
2017-01-29 21:49:41 +00:00
Amine Khaldi
e0748b5d54 [0.4.4] * Apply the patch that allows us to dynamically change the resolution by resizing in VirtualBox. CORE-6742
svn path=/branches/ros-branch-0_4_4/; revision=73628
2017-01-29 21:09:43 +00:00
Amine Khaldi
acef69b782 [0.4.4] Add a hack by Thomas to avoid MmGetPhysicalAddress failures during USB transfers. CORE-9224
svn path=/branches/ros-branch-0_4_4/; revision=73627
2017-01-29 20:30:58 +00:00
Amine Khaldi
a72e5c7ae7 [0.4.4] * Disable COMMAND.COM debugging messages. CORE-10710
svn path=/branches/ros-branch-0_4_4/; revision=73625
2017-01-29 20:27:29 +00:00
Amine Khaldi
ea9b9f64ed [0.4.4] * Apply the Wordpad related hack from CORE-5823 by Jared Smudde.
svn path=/branches/ros-branch-0_4_4/; revision=73624
2017-01-29 20:26:21 +00:00
Thomas Faber
2fdb5f83c4 [0.4.4]
- Update start menu banner

svn path=/branches/ros-branch-0_4_4/; revision=73609
2017-01-28 19:09:24 +00:00
Amine Khaldi
7116cce138 [0.4.4] Update the version number.
svn path=/branches/ros-branch-0_4_4/; revision=73603
2017-01-27 09:54:34 +00:00
23 changed files with 561 additions and 520 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -96,7 +96,6 @@ class CDefView :
LONG m_iDragOverItem; /* Dragged over item's index, iff m_pCurDropTarget != NULL */
UINT m_cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
POINT m_ptLastMousePos; /* Mouse position at last DragOver call */
POINT m_ptFirstMousePos; /* Mouse position when the drag operation started */
//
CComPtr<IContextMenu> m_pCM;
@@ -1757,8 +1756,6 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
DWORD dwEffect2;
m_pSourceDataObject = pda;
m_ptFirstMousePos = ((LPNMLISTVIEW)lParam)->ptAction;
ClientToScreen(&m_ptFirstMousePos);
DoDragDrop(pda, this, dwEffect, &dwEffect2);
@@ -2905,6 +2902,7 @@ HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState,
{
/* Get a hold on the data object for later calls to DragEnter on the sub-folders */
m_pCurDataObject = pDataObject;
pDataObject->AddRef();
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
}
@@ -2938,22 +2936,11 @@ HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINT
if ((m_iDragOverItem == -1) &&
(*pdwEffect & DROPEFFECT_MOVE) &&
/*(GetKeyState(VK_LBUTTON) != 0) &&*/
(GetKeyState(VK_LBUTTON) != 0) &&
(m_pSourceDataObject.p) &&
(SHIsSameObject(pDataObject, m_pSourceDataObject)))
{
/* Reposition the items */
int lvIndex = -1;
while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
{
POINT ptItem;
if (m_ListView.GetItemPosition(lvIndex, &ptItem))
{
ptItem.x += pt.x - m_ptFirstMousePos.x;
ptItem.y += pt.y - m_ptFirstMousePos.y;
m_ListView.SetItemPosition(lvIndex, &ptItem);
}
}
ERR("Should implement moving items here!\n");
if (m_pCurDropTarget)
{

View File

@@ -76,8 +76,6 @@ class CDefaultContextMenu :
PStaticShellEntry m_pStaticEntries; /* first static shell extension entry */
UINT m_iIdSCMFirst; /* first static used id */
UINT m_iIdSCMLast; /* last static used id */
UINT m_iIdCBFirst; /* first callback used id */
UINT m_iIdCBLast; /* last callback used id */
HRESULT _DoCallback(UINT uMsg, WPARAM wParam, LPVOID lParam);
void AddStaticEntry(const HKEY hkeyClass, const WCHAR *szVerb);
@@ -86,7 +84,8 @@ class CDefaultContextMenu :
HRESULT LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *pclsid);
BOOL EnumerateDynamicContextHandlerForKey(HKEY hRootKey);
UINT InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, UINT IndexMenu, UINT idCmdFirst, UINT idCmdLast);
UINT AddStaticContextMenusToMenu(HMENU hMenu, UINT IndexMenu, UINT iIdCmdFirst, UINT iIdCmdLast);
UINT AddStaticContextMenusToMenu(HMENU hMenu, UINT IndexMenu);
UINT BuildShellItemContextMenu(HMENU hMenu, UINT iIdCmdFirst, UINT iIdCmdLast, UINT uFlags);
HRESULT DoPaste(LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink);
HRESULT DoOpenOrExplore(LPCMINVOKECOMMANDINFO lpcmi);
HRESULT DoCreateLink(LPCMINVOKECOMMANDINFO lpcmi);
@@ -147,9 +146,7 @@ CDefaultContextMenu::CDefaultContextMenu() :
m_iIdSHELast(0),
m_pStaticEntries(NULL),
m_iIdSCMFirst(0),
m_iIdSCMLast(0),
m_iIdCBFirst(0),
m_iIdCBLast(0)
m_iIdSCMLast(0)
{
}
@@ -473,6 +470,8 @@ CDefaultContextMenu::InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, U
}
PDynamicShellEntry pEntry = m_pDynamicEntries;
idCmdFirst = 0x5000;
idCmdLast = 0x6000;
m_iIdSHEFirst = idCmdFirst;
do
{
@@ -483,13 +482,6 @@ CDefaultContextMenu::InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, U
pEntry->NumIds = LOWORD(hr);
IndexMenu += pEntry->NumIds;
idCmdFirst += pEntry->NumIds + 0x10;
if(idCmdFirst >= idCmdLast)
{
/* There is no more room for items */
idCmdFirst = idCmdLast;
break;
}
}
TRACE("pEntry %p hr %x contextmenu %p cmdfirst %x num ids %x\n", pEntry, hr, pEntry->pCM, pEntry->iIdCmdFirst, pEntry->NumIds);
pEntry = pEntry->pNext;
@@ -503,9 +495,7 @@ CDefaultContextMenu::InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, U
UINT
CDefaultContextMenu::AddStaticContextMenusToMenu(
HMENU hMenu,
UINT IndexMenu,
UINT iIdCmdFirst,
UINT iIdCmdLast)
UINT IndexMenu)
{
MENUITEMINFOW mii;
UINT idResource;
@@ -515,7 +505,7 @@ CDefaultContextMenu::AddStaticContextMenusToMenu(
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE | MIIM_DATA;
mii.fType = MFT_STRING;
mii.wID = iIdCmdFirst;
mii.wID = 0x4000;
mii.dwTypeData = NULL;
m_iIdSCMFirst = mii.wID;
@@ -600,9 +590,6 @@ CDefaultContextMenu::AddStaticContextMenusToMenu(
mii.wID++;
pEntry = pEntry->pNext;
if (mii.wID >= iIdCmdLast)
break;
}
m_iIdSCMLast = mii.wID - 1;
@@ -658,11 +645,6 @@ CDefaultContextMenu::QueryContextMenu(
UINT uFlags)
{
HRESULT hr;
UINT idCmdNext = idCmdFirst;
/* Add a tiny hack to make all the shell happy until we understand how we should handle 0 ids */
if (!idCmdNext)
idCmdNext = 1;
TRACE("BuildShellItemContextMenu entered\n");
@@ -674,40 +656,35 @@ CDefaultContextMenu::QueryContextMenu(
}
/* Add static context menu handlers */
IndexMenu = AddStaticContextMenusToMenu(hMenu, IndexMenu, idCmdNext, idCmdLast);
if (m_iIdSCMLast && m_iIdSCMFirst != m_iIdSCMLast)
idCmdNext = m_iIdSCMLast + 1;
IndexMenu = AddStaticContextMenusToMenu(hMenu, IndexMenu);
/* Add dynamic context menu handlers */
BOOL bAddSep = FALSE;
IndexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, IndexMenu, idCmdNext, idCmdLast);
if (m_iIdSHELast && m_iIdSHELast != m_iIdSHEFirst)
idCmdNext = m_iIdSHELast + 1;
IndexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, IndexMenu, idCmdFirst, idCmdLast);
TRACE("IndexMenu %d\n", IndexMenu);
/* Now let the callback add its own items */
QCMINFO qcminfo = {hMenu, IndexMenu, idCmdNext, idCmdLast, NULL};
if (SUCCEEDED(_DoCallback(DFM_MERGECONTEXTMENU, uFlags, &qcminfo)))
{
m_iIdCBFirst = idCmdNext;
m_iIdCBLast = qcminfo.idCmdFirst;
idCmdNext = m_iIdCBLast + 1;
}
/* The rest of the items will be added in the end of the menu */
QCMINFO qcminfo;
qcminfo.hmenu = hMenu;
qcminfo.indexMenu = IndexMenu;
qcminfo.idCmdFirst = idCmdFirst;
qcminfo.idCmdLast = idCmdLast;
qcminfo.pIdMap = NULL;
_DoCallback(DFM_MERGECONTEXTMENU, uFlags, &qcminfo);
IndexMenu = GetMenuItemCount(hMenu);
if (uFlags & CMF_VERBSONLY)
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdNext - idCmdFirst);
return S_OK;
/* If this is a background context menu we are done */
if (!m_cidl)
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdNext - idCmdFirst);
return S_OK;
/* Get the attributes of the items */
SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
hr = m_psf->GetAttributesOf(m_cidl, m_apidl, &rfg);
if (FAILED_UNEXPECTEDLY(hr))
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdNext - idCmdFirst);
return S_OK;
/* Add the standard menu entries based on the attributes of the items */
BOOL bClipboardData = (HasClipboardData() && (rfg & SFGAO_FILESYSTEM));
@@ -1229,6 +1206,9 @@ CDefaultContextMenu::InvokeCommand(
Result = DoCreateNewFolder(&LocalInvokeInfo);
break;
default:
_DoCallback(DFM_INVOKECOMMAND, LOWORD(LocalInvokeInfo.lpVerb), NULL);
Result = E_UNEXPECTED;
break;
}
@@ -1236,27 +1216,21 @@ CDefaultContextMenu::InvokeCommand(
/* Check for ID's we didn't find a handler for */
if (Result == E_UNEXPECTED)
{
if (m_pDynamicEntries)
if (m_iIdSHEFirst && m_iIdSHELast)
{
if (LOWORD(LocalInvokeInfo.lpVerb) >= m_iIdSHEFirst && LOWORD(LocalInvokeInfo.lpVerb) <= m_iIdSHELast)
Result = DoDynamicShellExtensions(&LocalInvokeInfo);
}
if (m_pStaticEntries)
if (m_iIdSCMFirst && m_iIdSCMLast)
{
if (LOWORD(LocalInvokeInfo.lpVerb) >= m_iIdSCMFirst && LOWORD(LocalInvokeInfo.lpVerb) <= m_iIdSCMLast)
Result = DoStaticShellExtensions(&LocalInvokeInfo);
}
if (m_iIdCBFirst != m_iIdCBLast)
{
if (LOWORD(LocalInvokeInfo.lpVerb) >= m_iIdCBFirst && LOWORD(LocalInvokeInfo.lpVerb) <= m_iIdCBLast)
Result = _DoCallback(DFM_INVOKECOMMAND, LOWORD(LocalInvokeInfo.lpVerb), NULL);
}
}
if (Result == E_UNEXPECTED)
ERR("Unhandled Verb %xl\n", LOWORD(LocalInvokeInfo.lpVerb));
FIXME("Unhandled Verb %xl\n", LOWORD(LocalInvokeInfo.lpVerb));
return Result;
}

View File

@@ -76,13 +76,17 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf,
if (!(dwFlags & FILE_READ_ONLY_VOLUME) && GetDriveTypeA(szDrive) != DRIVE_REMOTE)
{
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, pqcminfo->idCmdFirst++, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED);
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0x7ABC, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED);
}
}
}
else if (uMsg == DFM_INVOKECOMMAND)
{
if (wParam == DFM_CMD_PROPERTIES)
if(wParam == 0x7ABC)
{
SHFormatDrive(hwnd, szDrive[0] - 'A', SHFMT_ID_DEFAULT, 0);
}
else if (wParam == DFM_CMD_PROPERTIES)
{
WCHAR wszBuf[4];
wcscpy(wszBuf, L"A:\\");
@@ -90,10 +94,6 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf,
if (!SH_ShowDriveProperties(wszBuf, pidlFolder, apidl))
hr = E_FAIL;
}
else
{
SHFormatDrive(hwnd, szDrive[0] - 'A', SHFMT_ID_DEFAULT, 0);
}
}
SHFree(pidlFolder);

View File

@@ -453,9 +453,6 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags )
sice.dwSourceIndex = dwSourceIndex;
sice.dwFlags = dwFlags;
if (!sic_hdpa)
SIC_Initialize();
EnterCriticalSection(&SHELL32_SicCS);
if (NULL != DPA_GetPtr (sic_hdpa, 0))
@@ -690,9 +687,6 @@ static int SIC_LoadOverlayIcon(int icon_idx)
RegCloseKey(hKeyShellIcons);
}
if (!sic_hdpa)
SIC_Initialize();
return SIC_LoadIcon(iconPath, iconIdx, 0);
}
@@ -704,17 +698,13 @@ static int SIC_LoadOverlayIcon(int icon_idx)
*
*/
BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList)
{
TRACE("(%p,%p)\n",lpBigList,lpSmallList);
if (!sic_hdpa)
SIC_Initialize();
{ TRACE("(%p,%p)\n",lpBigList,lpSmallList);
if (lpBigList)
*lpBigList = ShellBigIconList;
{ *lpBigList = ShellBigIconList;
}
if (lpSmallList)
*lpSmallList = ShellSmallIconList;
{ *lpSmallList = ShellSmallIconList;
}
return TRUE;
}
@@ -745,9 +735,6 @@ BOOL PidlToSicIndex (
TRACE("sf=%p pidl=%p %s\n", sh, pidl, bBigIcon?"Big":"Small");
if (!sic_hdpa)
SIC_Initialize();
if (SUCCEEDED (sh->GetUIObjectOf(0, 1, &pidl, IID_NULL_PPV_ARG(IExtractIconW, &ei))))
{
if (SUCCEEDED(ei->GetIconLocation(uFlags, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags)))

View File

@@ -347,6 +347,7 @@ STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
InitCommonControlsEx(&InitCtrls);
/* Bad idea, initialization in DllMain! */
SIC_Initialize();
InitChangeNotifications();
}
else if (dwReason == DLL_PROCESS_DETACH)

View File

@@ -1292,8 +1292,8 @@ BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
*
*/
BOOL WINAPI FileIconInit(BOOL bFullInit)
{
return SIC_Initialize();
{ FIXME("(%s)\n", bFullInit ? "true" : "false");
return FALSE;
}
/*************************************************************************

View File

@@ -601,6 +601,7 @@ CUSBRequest::InitDescriptor(
//
// get address
//
*(volatile char *)TransferBuffer; // HACK for CORE-9224
Address = MmGetPhysicalAddress(TransferBuffer);
//

View File

@@ -771,6 +771,7 @@ CUSBRequest::BuildIsochronousEndpoint(
//
// get physical page
//
*(volatile char *)Buffer; // HACK for CORE-9224
Page = MmGetPhysicalAddress(Buffer).LowPart;
//

View File

@@ -160,14 +160,9 @@ NTAPI
FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
IN PANSI_STRING Name)
{
USHORT Offset, Position, BackTrackingPosition, OldBackTrackingPosition;
USHORT BackTrackingBuffer[16], OldBackTrackingBuffer[16] = {0};
PUSHORT BackTrackingSwap, BackTracking = BackTrackingBuffer, OldBackTracking = OldBackTrackingBuffer;
USHORT ExpressionPosition, NamePosition = 0, MatchingChars = 1;
USHORT NameChar = 0, ExpressionChar;
BOOLEAN EndOfName = FALSE;
BOOLEAN Result;
BOOLEAN DontSkipDot;
SHORT StarFound = -1, DosStarFound = -1;
PUSHORT BackTracking = NULL, DosBackTracking = NULL;
USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars, LastDot;
PAGED_CODE();
ASSERT(Name->Length);
@@ -237,180 +232,170 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
}
}
/* Name parsing loop */
for (; !EndOfName; MatchingChars = BackTrackingPosition)
while (NamePosition < Name->Length && ExpressionPosition < Expression->Length)
{
/* Reset positions */
OldBackTrackingPosition = BackTrackingPosition = 0;
if (NamePosition >= Name->Length)
/* Basic check to test if chars are equal */
if ((Expression->Buffer[ExpressionPosition] == Name->Buffer[NamePosition]))
{
EndOfName = TRUE;
if (OldBackTracking[MatchingChars - 1] == Expression->Length * 2)
break;
NamePosition++;
ExpressionPosition++;
}
else
/* Check cases that eat one char */
else if (Expression->Buffer[ExpressionPosition] == '?')
{
/* If lead byte present */
if (FsRtlIsLeadDbcsCharacter(Name->Buffer[NamePosition]))
NamePosition++;
ExpressionPosition++;
}
/* Test star */
else if (Expression->Buffer[ExpressionPosition] == '*')
{
/* Skip contigous stars */
while (ExpressionPosition + 1 < Expression->Length && Expression->Buffer[ExpressionPosition + 1] == '*')
{
NameChar = Name->Buffer[NamePosition] +
(0x100 * Name->Buffer[NamePosition + 1]);
NamePosition += sizeof(USHORT);
ExpressionPosition++;
}
/* Save star position */
if (!BackTracking)
{
BackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
Expression->Length * sizeof(USHORT), 'nrSF');
}
BackTracking[++StarFound] = ExpressionPosition++;
/* If star is at the end, then eat all rest and leave */
if (ExpressionPosition == Expression->Length)
{
NamePosition = Name->Length;
break;
}
/* Allow null matching */
else if (Expression->Buffer[ExpressionPosition] != '?' &&
Expression->Buffer[ExpressionPosition] != Name->Buffer[NamePosition])
{
NamePosition++;
}
}
/* Check DOS_STAR */
else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR)
{
/* Skip contigous stars */
while (ExpressionPosition + 1 < Expression->Length && Expression->Buffer[ExpressionPosition + 1] == ANSI_DOS_STAR)
{
ExpressionPosition++;
}
/* Look for last dot */
MatchingChars = 0;
LastDot = (USHORT)-1;
while (MatchingChars < Name->Length)
{
if (Name->Buffer[MatchingChars] == '.')
{
LastDot = MatchingChars;
if (LastDot > NamePosition)
break;
}
MatchingChars++;
}
/* If we don't have dots or we didn't find last yet
* start eating everything
*/
if (MatchingChars != Name->Length || LastDot == (USHORT)-1)
{
if (!DosBackTracking) DosBackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
Expression->Length * sizeof(USHORT), 'nrSF');
DosBackTracking[++DosStarFound] = ExpressionPosition++;
/* Not the same char, start exploring */
if (Expression->Buffer[ExpressionPosition] != Name->Buffer[NamePosition])
NamePosition++;
}
else
{
NameChar = Name->Buffer[NamePosition];
NamePosition += sizeof(UCHAR);
/* Else, if we are at last dot, eat it - otherwise, null match */
if (Name->Buffer[NamePosition] == '.')
NamePosition++;
ExpressionPosition++;
}
}
while (MatchingChars > OldBackTrackingPosition)
/* Check DOS_DOT */
else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT)
{
ExpressionPosition = (OldBackTracking[OldBackTrackingPosition++] + 1) / 2;
/* Expression parsing loop */
for (Offset = 0; ExpressionPosition < Expression->Length; )
/* We only match dots */
if (Name->Buffer[NamePosition] == '.')
{
ExpressionPosition += Offset;
NamePosition++;
}
/* Try to explore later on for null matching */
else if (ExpressionPosition + 1 < Expression->Length &&
Name->Buffer[NamePosition] == Expression->Buffer[ExpressionPosition + 1])
{
NamePosition++;
}
ExpressionPosition++;
}
/* Check DOS_QM */
else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM)
{
/* We match everything except dots */
if (Name->Buffer[NamePosition] != '.')
{
NamePosition++;
}
ExpressionPosition++;
}
/* If nothing match, try to backtrack */
else if (StarFound >= 0)
{
ExpressionPosition = BackTracking[StarFound--];
}
else if (DosStarFound >= 0)
{
ExpressionPosition = DosBackTracking[DosStarFound--];
}
/* Otherwise, fail */
else
{
break;
}
if (ExpressionPosition == Expression->Length)
{
BackTracking[BackTrackingPosition++] = Expression->Length * 2;
break;
}
/* If buffer too small */
if (BackTrackingPosition > RTL_NUMBER_OF(BackTrackingBuffer) - 1)
{
/* Allocate memory for BackTracking */
BackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
(Expression->Length + 1) * sizeof(USHORT) * 2,
'nrSF');
/* Copy old buffer content */
RtlCopyMemory(BackTracking,
BackTrackingBuffer,
RTL_NUMBER_OF(BackTrackingBuffer) * sizeof(USHORT));
/* Allocate memory for OldBackTracking */
OldBackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
(Expression->Length + 1) * sizeof(USHORT) * 2,
'nrSF');
/* Copy old buffer content */
RtlCopyMemory(OldBackTracking,
OldBackTrackingBuffer,
RTL_NUMBER_OF(OldBackTrackingBuffer) * sizeof(USHORT));
}
/* If lead byte present */
if (FsRtlIsLeadDbcsCharacter(Expression->Buffer[ExpressionPosition]))
{
ExpressionChar = Expression->Buffer[ExpressionPosition] +
(0x100 * Expression->Buffer[ExpressionPosition + 1]);
Offset = sizeof(USHORT);
}
else
{
ExpressionChar = Expression->Buffer[ExpressionPosition];
Offset = sizeof(UCHAR);
}
/* Basic check to test if chars are equal */
if (ExpressionChar == NameChar && !EndOfName)
{
BackTracking[BackTrackingPosition++] = (ExpressionPosition + Offset) * 2;
}
/* Check cases that eat one char */
else if (ExpressionChar == '?' && !EndOfName)
{
BackTracking[BackTrackingPosition++] = (ExpressionPosition + Offset) * 2;
}
/* Test star */
else if (ExpressionChar == '*')
{
BackTracking[BackTrackingPosition++] = ExpressionPosition * 2;
BackTracking[BackTrackingPosition++] = (ExpressionPosition * 2) + 1;
continue;
}
/* Check DOS_STAR */
else if (ExpressionChar == ANSI_DOS_STAR)
{
/* Look for last dot */
DontSkipDot = TRUE;
if (!EndOfName && NameChar == '.')
{
for (Position = NamePosition; Position < Name->Length; )
{
/* If lead byte not present */
if (!FsRtlIsLeadDbcsCharacter(Name->Buffer[Position]))
{
if (Name->Buffer[Position] == '.')
{
DontSkipDot = FALSE;
break;
}
Position += sizeof(UCHAR);
}
else
{
Position += sizeof(USHORT);
}
}
}
if (EndOfName || NameChar != '.' || !DontSkipDot)
BackTracking[BackTrackingPosition++] = ExpressionPosition * 2;
BackTracking[BackTrackingPosition++] = (ExpressionPosition * 2) + 1;
continue;
}
/* Check DOS_DOT */
else if (ExpressionChar == DOS_DOT)
{
if (EndOfName) continue;
if (NameChar == '.')
BackTracking[BackTrackingPosition++] = (ExpressionPosition + Offset) * 2;
}
/* Check DOS_QM */
else if (ExpressionChar == ANSI_DOS_QM)
{
if (EndOfName || NameChar == '.') continue;
BackTracking[BackTrackingPosition++] = (ExpressionPosition + Offset) * 2;
}
/* Leave from loop */
/* Under certain circumstances, expression is over, but name isn't
* and we can backtrack, then, backtrack */
if (ExpressionPosition == Expression->Length &&
NamePosition != Name->Length && StarFound >= 0)
{
ExpressionPosition = BackTracking[StarFound--];
}
}
/* If we have nullable matching wc at the end of the string, eat them */
if (ExpressionPosition != Expression->Length && NamePosition == Name->Length)
{
while (ExpressionPosition < Expression->Length)
{
if (Expression->Buffer[ExpressionPosition] != ANSI_DOS_DOT &&
Expression->Buffer[ExpressionPosition] != '*' &&
Expression->Buffer[ExpressionPosition] != ANSI_DOS_STAR)
{
break;
}
for (Position = 0; MatchingChars > OldBackTrackingPosition && Position < BackTrackingPosition; Position++)
{
while (MatchingChars > OldBackTrackingPosition &&
BackTracking[Position] > OldBackTracking[OldBackTrackingPosition])
{
++OldBackTrackingPosition;
}
}
ExpressionPosition++;
}
/* Swap pointers */
BackTrackingSwap = BackTracking;
BackTracking = OldBackTracking;
OldBackTracking = BackTrackingSwap;
}
/* Store result value */
Result = (OldBackTracking[MatchingChars - 1] == Expression->Length * 2);
/* Frees the memory if necessary */
if (BackTracking != BackTrackingBuffer && BackTracking != OldBackTrackingBuffer)
if (BackTracking)
{
ExFreePoolWithTag(BackTracking, 'nrSF');
if (OldBackTracking != BackTrackingBuffer && OldBackTracking != OldBackTrackingBuffer)
ExFreePoolWithTag(OldBackTracking, 'nrSF');
}
if (DosBackTracking)
{
ExFreePoolWithTag(DosBackTracking, 'nrSF');
}
return Result;
return (ExpressionPosition == Expression->Length && NamePosition == Name->Length);
}
/*++

View File

@@ -23,14 +23,13 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
IN BOOLEAN IgnoreCase,
IN PWCHAR UpcaseTable OPTIONAL)
{
USHORT Offset, Position, BackTrackingPosition, OldBackTrackingPosition;
USHORT BackTrackingBuffer[16], OldBackTrackingBuffer[16] = {0};
PUSHORT BackTrackingSwap, BackTracking = BackTrackingBuffer, OldBackTracking = OldBackTrackingBuffer;
SHORT StarFound = -1, DosStarFound = -1;
USHORT BackTrackingBuffer[5], DosBackTrackingBuffer[5];
PUSHORT BackTracking = BackTrackingBuffer, DosBackTracking = DosBackTrackingBuffer;
SHORT BackTrackingSize = RTL_NUMBER_OF(BackTrackingBuffer);
SHORT DosBackTrackingSize = RTL_NUMBER_OF(DosBackTrackingBuffer);
UNICODE_STRING IntExpression;
USHORT ExpressionPosition, NamePosition = 0, MatchingChars = 1;
BOOLEAN EndOfName = FALSE;
BOOLEAN Result;
BOOLEAN DontSkipDot;
USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars, LastDot;
WCHAR CompareChar;
PAGED_CODE();
@@ -38,7 +37,7 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
if (!Name->Length || !Expression->Length)
{
/* Return TRUE if both strings are empty, otherwise FALSE */
if (!Name->Length && !Expression->Length)
if (Name->Length == 0 && Expression->Length == 0)
return TRUE;
else
return FALSE;
@@ -104,144 +103,193 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
}
}
/* Name parsing loop */
for (; !EndOfName; MatchingChars = BackTrackingPosition, NamePosition++)
while ((NamePosition < Name->Length / sizeof(WCHAR)) &&
(ExpressionPosition < Expression->Length / sizeof(WCHAR)))
{
/* Reset positions */
OldBackTrackingPosition = BackTrackingPosition = 0;
if (NamePosition >= Name->Length / sizeof(WCHAR))
/* Basic check to test if chars are equal */
CompareChar = IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
Name->Buffer[NamePosition];
if (Expression->Buffer[ExpressionPosition] == CompareChar)
{
EndOfName = TRUE;
if (OldBackTracking[MatchingChars - 1] == Expression->Length * 2)
break;
NamePosition++;
ExpressionPosition++;
}
while (MatchingChars > OldBackTrackingPosition)
/* Check cases that eat one char */
else if (Expression->Buffer[ExpressionPosition] == L'?')
{
ExpressionPosition = (OldBackTracking[OldBackTrackingPosition++] + 1) / 2;
/* Expression parsing loop */
for (Offset = 0; ExpressionPosition < Expression->Length; Offset = sizeof(WCHAR))
NamePosition++;
ExpressionPosition++;
}
/* Test star */
else if (Expression->Buffer[ExpressionPosition] == L'*')
{
/* Skip contigous stars */
while ((ExpressionPosition + 1 < (USHORT)(Expression->Length / sizeof(WCHAR))) &&
(Expression->Buffer[ExpressionPosition + 1] == L'*'))
{
ExpressionPosition += Offset;
ExpressionPosition++;
}
if (ExpressionPosition == Expression->Length)
/* Save star position */
StarFound++;
if (StarFound >= BackTrackingSize)
{
ASSERT(BackTracking == BackTrackingBuffer);
BackTrackingSize = Expression->Length / sizeof(WCHAR);
BackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
BackTrackingSize * sizeof(USHORT),
'nrSF');
RtlCopyMemory(BackTracking, BackTrackingBuffer, sizeof(BackTrackingBuffer));
}
BackTracking[StarFound] = ExpressionPosition++;
/* If star is at the end, then eat all rest and leave */
if (ExpressionPosition == Expression->Length / sizeof(WCHAR))
{
NamePosition = Name->Length / sizeof(WCHAR);
break;
}
/* Allow null matching */
if (Expression->Buffer[ExpressionPosition] != L'?' &&
Expression->Buffer[ExpressionPosition] != Name->Buffer[NamePosition])
{
NamePosition++;
}
}
/* Check DOS_STAR */
else if (Expression->Buffer[ExpressionPosition] == DOS_STAR)
{
/* Skip contigous stars */
while ((ExpressionPosition + 1 < (USHORT)(Expression->Length / sizeof(WCHAR))) &&
(Expression->Buffer[ExpressionPosition + 1] == DOS_STAR))
{
ExpressionPosition++;
}
/* Look for last dot */
MatchingChars = 0;
LastDot = (USHORT)-1;
while (MatchingChars < Name->Length / sizeof(WCHAR))
{
if (Name->Buffer[MatchingChars] == L'.')
{
BackTracking[BackTrackingPosition++] = Expression->Length * 2;
break;
LastDot = MatchingChars;
if (LastDot > NamePosition)
break;
}
/* If buffer too small */
if (BackTrackingPosition > RTL_NUMBER_OF(BackTrackingBuffer) - 1)
{
/* Allocate memory for BackTracking */
BackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
(Expression->Length + sizeof(WCHAR)) * sizeof(USHORT),
'nrSF');
/* Copy old buffer content */
RtlCopyMemory(BackTracking,
BackTrackingBuffer,
RTL_NUMBER_OF(BackTrackingBuffer) * sizeof(USHORT));
MatchingChars++;
}
/* Allocate memory for OldBackTracking */
OldBackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
(Expression->Length + sizeof(WCHAR)) * sizeof(USHORT),
/* If we don't have dots or we didn't find last yet
* start eating everything
*/
if (MatchingChars != Name->Length || LastDot == (USHORT)-1)
{
DosStarFound++;
if (DosStarFound >= DosBackTrackingSize)
{
ASSERT(DosBackTracking == DosBackTrackingBuffer);
DosBackTrackingSize = Expression->Length / sizeof(WCHAR);
DosBackTracking = ExAllocatePoolWithTag(PagedPool | POOL_RAISE_IF_ALLOCATION_FAILURE,
DosBackTrackingSize * sizeof(USHORT),
'nrSF');
/* Copy old buffer content */
RtlCopyMemory(OldBackTracking,
OldBackTrackingBuffer,
RTL_NUMBER_OF(OldBackTrackingBuffer) * sizeof(USHORT));
RtlCopyMemory(DosBackTracking, DosBackTrackingBuffer, sizeof(DosBackTrackingBuffer));
}
DosBackTracking[DosStarFound] = ExpressionPosition++;
/* Basic check to test if chars are equal */
CompareChar = IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
Name->Buffer[NamePosition];
if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == CompareChar && !EndOfName)
{
BackTracking[BackTrackingPosition++] = (ExpressionPosition + sizeof(WCHAR)) * 2;
}
/* Check cases that eat one char */
else if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == L'?' && !EndOfName)
{
BackTracking[BackTrackingPosition++] = (ExpressionPosition + sizeof(WCHAR)) * 2;
}
/* Test star */
else if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == L'*')
{
BackTracking[BackTrackingPosition++] = ExpressionPosition * 2;
BackTracking[BackTrackingPosition++] = (ExpressionPosition * 2) + 3;
continue;
}
/* Check DOS_STAR */
else if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == DOS_STAR)
{
/* Look for last dot */
DontSkipDot = TRUE;
if (!EndOfName && Name->Buffer[NamePosition] == '.')
{
for (Position = NamePosition - 1; Position < Name->Length; Position++)
{
if (Name->Buffer[Position] == L'.')
{
DontSkipDot = FALSE;
break;
}
}
}
if (EndOfName || Name->Buffer[NamePosition] != L'.' || !DontSkipDot)
BackTracking[BackTrackingPosition++] = ExpressionPosition * 2;
BackTracking[BackTrackingPosition++] = (ExpressionPosition * 2) + 3;
continue;
}
/* Check DOS_DOT */
else if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == DOS_DOT)
{
if (EndOfName) continue;
if (Name->Buffer[NamePosition] == L'.')
BackTracking[BackTrackingPosition++] = (ExpressionPosition + sizeof(WCHAR)) * 2;
}
/* Check DOS_QM */
else if (Expression->Buffer[ExpressionPosition / sizeof(WCHAR)] == DOS_QM)
{
if (EndOfName || Name->Buffer[NamePosition] == L'.') continue;
BackTracking[BackTrackingPosition++] = (ExpressionPosition + sizeof(WCHAR)) * 2;
}
/* Leave from loop */
break;
/* Not the same char, start exploring */
if (Expression->Buffer[ExpressionPosition] != Name->Buffer[NamePosition])
NamePosition++;
}
for (Position = 0; MatchingChars > OldBackTrackingPosition && Position < BackTrackingPosition; Position++)
else
{
while (MatchingChars > OldBackTrackingPosition &&
BackTracking[Position] > OldBackTracking[OldBackTrackingPosition])
{
++OldBackTrackingPosition;
}
/* Else, if we are at last dot, eat it - otherwise, null match */
if (Name->Buffer[NamePosition] == '.')
NamePosition++;
ExpressionPosition++;
}
}
/* Check DOS_DOT */
else if (Expression->Buffer[ExpressionPosition] == DOS_DOT)
{
/* We only match dots */
if (Name->Buffer[NamePosition] == L'.')
{
NamePosition++;
}
/* Try to explore later on for null matching */
else if ((ExpressionPosition + 1 < (USHORT)(Expression->Length / sizeof(WCHAR))) &&
(Name->Buffer[NamePosition] == Expression->Buffer[ExpressionPosition + 1]))
{
NamePosition++;
}
ExpressionPosition++;
}
/* Check DOS_QM */
else if (Expression->Buffer[ExpressionPosition] == DOS_QM)
{
/* We match everything except dots */
if (Name->Buffer[NamePosition] != L'.')
{
NamePosition++;
}
ExpressionPosition++;
}
/* If nothing match, try to backtrack */
else if (StarFound >= 0)
{
ExpressionPosition = BackTracking[StarFound--];
}
else if (DosStarFound >= 0)
{
ExpressionPosition = DosBackTracking[DosStarFound--];
}
/* Otherwise, fail */
else
{
break;
}
/* Swap pointers */
BackTrackingSwap = BackTracking;
BackTracking = OldBackTracking;
OldBackTracking = BackTrackingSwap;
/* Under certain circumstances, expression is over, but name isn't
* and we can backtrack, then, backtrack */
if (ExpressionPosition == Expression->Length / sizeof(WCHAR) &&
NamePosition != Name->Length / sizeof(WCHAR) &&
StarFound >= 0)
{
ExpressionPosition = BackTracking[StarFound--];
}
}
/* If we have nullable matching wc at the end of the string, eat them */
if (ExpressionPosition != Expression->Length / sizeof(WCHAR) && NamePosition == Name->Length / sizeof(WCHAR))
{
while (ExpressionPosition < Expression->Length / sizeof(WCHAR))
{
if (Expression->Buffer[ExpressionPosition] != DOS_DOT &&
Expression->Buffer[ExpressionPosition] != L'*' &&
Expression->Buffer[ExpressionPosition] != DOS_STAR)
{
break;
}
ExpressionPosition++;
}
}
/* Store result value */
Result = (OldBackTracking[MatchingChars - 1] == (Expression->Length * 2));
/* Frees the memory if necessary */
if (BackTracking != BackTrackingBuffer && BackTracking != OldBackTrackingBuffer)
if (BackTracking != BackTrackingBuffer)
{
ExFreePoolWithTag(BackTracking, 'nrSF');
if (OldBackTracking != BackTrackingBuffer && OldBackTracking != OldBackTrackingBuffer)
ExFreePoolWithTag(OldBackTracking, 'nrSF');
}
if (DosBackTracking != DosBackTrackingBuffer)
{
ExFreePoolWithTag(DosBackTracking, 'nrSF');
}
return Result;
return (ExpressionPosition == Expression->Length / sizeof(WCHAR) && NamePosition == Name->Length / sizeof(WCHAR));
}
/* PUBLIC FUNCTIONS **********************************************************/

View File

@@ -17,12 +17,12 @@ endmacro()
string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC)
set(KERNEL_VERSION_MAJOR "0")
set(KERNEL_VERSION_MINOR "5")
set(KERNEL_VERSION_PATCH_LEVEL "0")
set(KERNEL_VERSION_MINOR "4")
set(KERNEL_VERSION_PATCH_LEVEL "4")
set(COPYRIGHT_YEAR "2017")
# KERNEL_VERSION_BUILD_TYPE is "SVN" or "" (for the release)
set(KERNEL_VERSION_BUILD_TYPE "SVN")
set(KERNEL_VERSION_BUILD_TYPE "")
# KERNEL_VERSION_RELEASE_TYPE is "RC1", "RC2" or "" (for the final one)
set(KERNEL_VERSION_RELEASE_TYPE "")

View File

@@ -17,7 +17,7 @@
#include "asmxtras.inc"
#include <isvbop.inc>
// #define NDEBUG
#define NDEBUG
/* DEFINES ********************************************************************/

View File

@@ -30,6 +30,132 @@ InitDeviceImpl(VOID)
return STATUS_SUCCESS;
}
BOOLEAN
EngpPopulateDeviceModeList(
_Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
_In_ PDEVMODEW pdmDefault)
{
PWSTR pwsz;
PLDEVOBJ pldev;
PDEVMODEINFO pdminfo;
PDEVMODEW pdm, pdmEnd;
ULONG i, cModes = 0;
BOOLEAN bModeMatch = FALSE;
ASSERT(pGraphicsDevice->pdevmodeInfo == NULL);
ASSERT(pGraphicsDevice->pDevModeList == NULL);
pwsz = pGraphicsDevice->pDiplayDrivers;
/* Loop through the driver names
* This is a REG_MULTI_SZ string */
for (; *pwsz; pwsz += wcslen(pwsz) + 1)
{
TRACE("trying driver: %ls\n", pwsz);
/* Try to load the display driver */
pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
if (!pldev)
{
ERR("Could not load driver: '%ls'\n", pwsz);
continue;
}
/* Get the mode list from the driver */
pdminfo = LDEVOBJ_pdmiGetModes(pldev, pGraphicsDevice->DeviceObject);
if (!pdminfo)
{
ERR("Could not get mode list for '%ls'\n", pwsz);
continue;
}
/* Attach the mode info to the device */
pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
pGraphicsDevice->pdevmodeInfo = pdminfo;
/* Loop all DEVMODEs */
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
for (pdm = pdminfo->adevmode;
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
{
/* Count this DEVMODE */
cModes++;
/* Some drivers like the VBox driver don't fill the dmDeviceName
with the name of the display driver. So fix that here. */
wcsncpy(pdm->dmDeviceName, pwsz, CCHDEVICENAME);
pdm->dmDeviceName[CCHDEVICENAME - 1] = 0;
}
// FIXME: release the driver again until it's used?
}
if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
{
ERR("No devmodes\n");
return FALSE;
}
/* Allocate an index buffer */
pGraphicsDevice->cDevModes = cModes;
pGraphicsDevice->pDevModeList = ExAllocatePoolWithTag(PagedPool,
cModes * sizeof(DEVMODEENTRY),
GDITAG_GDEVICE);
if (!pGraphicsDevice->pDevModeList)
{
ERR("No devmode list\n");
return FALSE;
}
TRACE("Looking for mode %lux%lux%lu(%lu Hz)\n",
pdmDefault->dmPelsWidth,
pdmDefault->dmPelsHeight,
pdmDefault->dmBitsPerPel,
pdmDefault->dmDisplayFrequency);
/* Loop through all DEVMODEINFOs */
for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
pdminfo;
pdminfo = pdminfo->pdmiNext)
{
/* Calculate End of the DEVMODEs */
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
/* Loop through the DEVMODEs */
for (pdm = pdminfo->adevmode;
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
{
TRACE(" %S has mode %lux%lux%lu(%lu Hz)\n",
pdm->dmDeviceName,
pdm->dmPelsWidth,
pdm->dmPelsHeight,
pdm->dmBitsPerPel,
pdm->dmDisplayFrequency);
/* Compare with the default entry */
if (!bModeMatch &&
pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
pdm->dmPelsHeight == pdmDefault->dmPelsHeight)
{
pGraphicsDevice->iDefaultMode = i;
pGraphicsDevice->iCurrentMode = i;
TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
if (pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
{
/* Uh oh, even the display frequency matches. */
bModeMatch = TRUE;
}
}
/* Initialize the entry */
pGraphicsDevice->pDevModeList[i].dwFlags = 0;
pGraphicsDevice->pDevModeList[i].pdm = pdm;
i++;
}
}
return TRUE;
}
PGRAPHICS_DEVICE
NTAPI
@@ -44,13 +170,9 @@ EngpRegisterGraphicsDevice(
PFILE_OBJECT pFileObject;
NTSTATUS Status;
PWSTR pwsz;
ULONG i, cj, cModes = 0;
ULONG cj;
SIZE_T cjWritten;
BOOL bEnable = TRUE;
PDEVMODEINFO pdminfo;
PDEVMODEW pdm, pdmEnd;
PLDEVOBJ pldev;
BOOLEAN bModeMatch = FALSE;
TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
@@ -124,116 +246,14 @@ EngpRegisterGraphicsDevice(
// FIXME: initialize state flags
pGraphicsDevice->StateFlags = 0;
/* Loop through the driver names
* This is a REG_MULTI_SZ string */
for (; *pwsz; pwsz += wcslen(pwsz) + 1)
/* Create the mode list */
pGraphicsDevice->pDevModeList = NULL;
if (!EngpPopulateDeviceModeList(pGraphicsDevice, pdmDefault))
{
TRACE("trying driver: %ls\n", pwsz);
/* Try to load the display driver */
pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
if (!pldev)
{
ERR("Could not load driver: '%ls'\n", pwsz);
continue;
}
/* Get the mode list from the driver */
pdminfo = LDEVOBJ_pdmiGetModes(pldev, pDeviceObject);
if (!pdminfo)
{
ERR("Could not get mode list for '%ls'\n", pwsz);
continue;
}
/* Attach the mode info to the device */
pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
pGraphicsDevice->pdevmodeInfo = pdminfo;
/* Loop all DEVMODEs */
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
for (pdm = pdminfo->adevmode;
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
{
/* Count this DEVMODE */
cModes++;
/* Some drivers like the VBox driver don't fill the dmDeviceName
with the name of the display driver. So fix that here. */
wcsncpy(pdm->dmDeviceName, pwsz, CCHDEVICENAME);
pdm->dmDeviceName[CCHDEVICENAME - 1] = 0;
}
// FIXME: release the driver again until it's used?
}
if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
{
ERR("No devmodes\n");
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
/* Allocate an index buffer */
pGraphicsDevice->cDevModes = cModes;
pGraphicsDevice->pDevModeList = ExAllocatePoolWithTag(PagedPool,
cModes * sizeof(DEVMODEENTRY),
GDITAG_GDEVICE);
if (!pGraphicsDevice->pDevModeList)
{
ERR("No devmode list\n");
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
TRACE("Looking for mode %lux%lux%lu(%lu Hz)\n",
pdmDefault->dmPelsWidth,
pdmDefault->dmPelsHeight,
pdmDefault->dmBitsPerPel,
pdmDefault->dmDisplayFrequency);
/* Loop through all DEVMODEINFOs */
for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
pdminfo;
pdminfo = pdminfo->pdmiNext)
{
/* Calculate End of the DEVMODEs */
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
/* Loop through the DEVMODEs */
for (pdm = pdminfo->adevmode;
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
{
TRACE(" %S has mode %lux%lux%lu(%lu Hz)\n",
pdm->dmDeviceName,
pdm->dmPelsWidth,
pdm->dmPelsHeight,
pdm->dmBitsPerPel,
pdm->dmDisplayFrequency);
/* Compare with the default entry */
if (!bModeMatch &&
pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
pdm->dmPelsHeight == pdmDefault->dmPelsHeight)
{
pGraphicsDevice->iDefaultMode = i;
pGraphicsDevice->iCurrentMode = i;
TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
if (pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
{
/* Uh oh, even the display frequency matches. */
bModeMatch = TRUE;
}
}
/* Initialize the entry */
pGraphicsDevice->pDevModeList[i].dwFlags = 0;
pGraphicsDevice->pDevModeList[i].pdm = pdm;
i++;
}
}
/* Lock loader */
EngAcquireSemaphore(ghsemGraphicsDeviceList);
@@ -250,7 +270,7 @@ EngpRegisterGraphicsDevice(
/* Unlock loader */
EngReleaseSemaphore(ghsemGraphicsDeviceList);
TRACE("Prepared %lu modes for %ls\n", cModes, pGraphicsDevice->pwszDescription);
TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription);
return pGraphicsDevice;
}

View File

@@ -3,6 +3,11 @@
#define TAG_GDEV 'gdev'
VOID
NTAPI
PDEVOBJ_vRefreshModeList(
PPDEVOBJ ppdev);
extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
extern PGRAPHICS_DEVICE gpVgaGraphicsDevice;
@@ -29,6 +34,11 @@ EngpRegisterGraphicsDevice(
_In_ PUNICODE_STRING pustrDescription,
_In_ PDEVMODEW pdmDefault);
BOOLEAN
EngpPopulateDeviceModeList(
_Inout_ PGRAPHICS_DEVICE pGraphicsDevice,
_In_ PDEVMODEW pdmDefault);
INIT_FUNCTION
NTSTATUS
NTAPI

View File

@@ -251,6 +251,45 @@ PDEVOBJ_pSurface(
return ppdev->pSurface;
}
VOID
NTAPI
PDEVOBJ_vRefreshModeList(
PPDEVOBJ ppdev)
{
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVMODEINFO pdminfo, pdmiNext;
DEVMODEW dmDefault;
/* Lock the PDEV */
EngAcquireSemaphore(ppdev->hsemDevLock);
pGraphicsDevice = ppdev->pGraphicsDevice;
/* Remember our default mode */
dmDefault = *pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm;
/* Clear out the modes */
for (pdminfo = pGraphicsDevice->pdevmodeInfo;
pdminfo;
pdminfo = pdmiNext)
{
pdmiNext = pdminfo->pdmiNext;
ExFreePoolWithTag(pdminfo, GDITAG_DEVMODE);
}
pGraphicsDevice->pdevmodeInfo = NULL;
ExFreePoolWithTag(pGraphicsDevice->pDevModeList, GDITAG_GDEVICE);
pGraphicsDevice->pDevModeList = NULL;
/* Now re-populate the list */
if (!EngpPopulateDeviceModeList(pGraphicsDevice, &dmDefault))
{
DPRINT1("FIXME: EngpPopulateDeviceModeList failed, we just destroyed a perfectly good mode list\n");
}
/* Unlock PDEV */
EngReleaseSemaphore(ppdev->hsemDevLock);
}
PDEVMODEW
NTAPI
PDEVOBJ_pdmMatchDevMode(

View File

@@ -463,20 +463,28 @@ UserEnumDisplaySettings(
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVMODEENTRY pdmentry;
ULONG i, iFoundMode;
PPDEVOBJ ppdev;
TRACE("Enter UserEnumDisplaySettings('%wZ', %lu)\n",
pustrDevice, iModeNum);
/* Ask GDI for the GRAPHICS_DEVICE */
pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0, 0);
ppdev = EngpGetPDEV(pustrDevice);
if (!pGraphicsDevice)
if (!pGraphicsDevice || !ppdev)
{
/* No device found */
ERR("No device found!\n");
return STATUS_INVALID_PARAMETER_1;
}
/* let's politely ask the driver for an updated mode list,
just in case there's something new in there (vbox) */
PDEVOBJ_vRefreshModeList(ppdev);
PDEVOBJ_vRelease(ppdev);
iFoundMode = 0;
for (i = 0; i < pGraphicsDevice->cDevModes; i++)
{

View File

@@ -1464,20 +1464,15 @@ IntCallWindowProcW(BOOL IsAnsiProc,
if (PreResult) goto Exit;
if (!Dialog)
Result = CALL_EXTERN_WNDPROC(WndProc, AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam);
else
{
_SEH2_TRY
{
Result = CALL_EXTERN_WNDPROC(WndProc, AnsiMsg.hwnd, AnsiMsg.message, AnsiMsg.wParam, AnsiMsg.lParam);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ERR("Exception Dialog Ansi %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
ERR("Exception when calling Ansi WndProc %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
}
_SEH2_END;
}
if (Hook && MsgOverride)
{
@@ -1518,20 +1513,15 @@ IntCallWindowProcW(BOOL IsAnsiProc,
if (PreResult) goto Exit;
if (!Dialog)
Result = CALL_EXTERN_WNDPROC(WndProc, hWnd, Msg, wParam, lParam);
else
{
_SEH2_TRY
{
Result = CALL_EXTERN_WNDPROC(WndProc, hWnd, Msg, wParam, lParam);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ERR("Exception Dialog unicode %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
ERR("Exception when calling unicode WndProc %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
}
_SEH2_END;
}
if (Hook && MsgOverride)
{
@@ -1611,20 +1601,15 @@ IntCallWindowProcA(BOOL IsAnsiProc,
if (PreResult) goto Exit;
if (!Dialog)
Result = CALL_EXTERN_WNDPROC(WndProc, hWnd, Msg, wParam, lParam);
else
{
_SEH2_TRY
{
Result = CALL_EXTERN_WNDPROC(WndProc, hWnd, Msg, wParam, lParam);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ERR("Exception Dialog Ansi %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
ERR("Exception when calling Ansi WndProc %p Msg %d pti %p Wndpti %p\n",WndProc,Msg,GetW32ThreadInfo(),pWnd->head.pti);
}
_SEH2_END;
}
if (Hook && MsgOverride)
{
@@ -1672,20 +1657,15 @@ IntCallWindowProcA(BOOL IsAnsiProc,
if (PreResult) goto Exit;
if (!Dialog)
Result = CALL_EXTERN_WNDPROC(WndProc, UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam);
else
{
_SEH2_TRY
{
Result = CALL_EXTERN_WNDPROC(WndProc, UnicodeMsg.hwnd, UnicodeMsg.message, UnicodeMsg.wParam, UnicodeMsg.lParam);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
ERR("Exception Dialog unicode %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
ERR("Exception when calling unicode WndProc %p Msg %d pti %p Wndpti %p\n",WndProc, Msg,GetW32ThreadInfo(),pWnd->head.pti);
}
_SEH2_END;
}
if (Hook && MsgOverride)
{