mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 04:23:32 +00:00
Sync with trunk (r49303)
svn path=/branches/cmake-bringup/; revision=49307
This commit is contained in:
commit
b2f64ac552
157 changed files with 10003 additions and 9064 deletions
|
@ -2,47 +2,47 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = Mozilla Firefox 3.6
|
Name = Mozilla Firefox 3.6
|
||||||
Version = 3.6.10
|
Version = 3.6.11
|
||||||
Licence = MPL/GPL/LGPL
|
Licence = MPL/GPL/LGPL
|
||||||
Description = The most popular and one of the best free Web Browsers out there.
|
Description = The most popular and one of the best free Web Browsers out there.
|
||||||
Size = 8.1M
|
Size = 8.1M
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.mozilla.com/en-US/
|
URLSite = http://www.mozilla.com/en-US/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/en-US/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/en-US/Firefox%20Setup%203.6.11.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
Description = Der populärste und einer der besten freien Webbrowser.
|
Description = Der populärste und einer der besten freien Webbrowser.
|
||||||
Size = 8.0M
|
Size = 8.0M
|
||||||
URLSite = http://www.mozilla-europe.org/de/
|
URLSite = http://www.mozilla-europe.org/de/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/de/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/de/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
||||||
[Section.040a]
|
[Section.040a]
|
||||||
Description = El más popular y uno de los mejores navegadores web gratuitos que hay.
|
Description = El más popular y uno de los mejores navegadores web gratuitos que hay.
|
||||||
Size = 8.0M
|
Size = 8.0M
|
||||||
URLSite = http://www.mozilla-europe.org/es/
|
URLSite = http://www.mozilla-europe.org/es/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/es-ES/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/es-ES/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
||||||
[Section.0414]
|
[Section.0414]
|
||||||
Description = Mest populære og best også gratis nettleserene der ute.
|
Description = Mest populære og best også gratis nettleserene der ute.
|
||||||
Size = 8.0M
|
Size = 8.0M
|
||||||
URLSite = http://www.mozilla-europe.org/no/
|
URLSite = http://www.mozilla-europe.org/no/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/nb-NO/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/nb-NO/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
||||||
[Section.0415]
|
[Section.0415]
|
||||||
Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych.
|
Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych.
|
||||||
Size = 8.8M
|
Size = 8.8M
|
||||||
URLSite = http://www.mozilla-europe.org/pl/
|
URLSite = http://www.mozilla-europe.org/pl/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/pl/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/pl/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
||||||
[Section.0419]
|
[Section.0419]
|
||||||
Description = Один из самых популярных и лучших бесплатных браузеров.
|
Description = Один из самых популярных и лучших бесплатных браузеров.
|
||||||
Size = 8.4M
|
Size = 8.4M
|
||||||
URLSite = http://www.mozilla-europe.org/ru/
|
URLSite = http://www.mozilla-europe.org/ru/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/ru/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/ru/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
||||||
[Section.0422]
|
[Section.0422]
|
||||||
Description = Найпопулярніший та один з кращих безплатних веб-браузерів.
|
Description = Найпопулярніший та один з кращих безплатних веб-браузерів.
|
||||||
Size = 8.4M
|
Size = 8.4M
|
||||||
URLSite = http://www.mozilla-europe.org/uk/
|
URLSite = http://www.mozilla-europe.org/uk/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.10/win32/uk/Firefox%20Setup%203.6.10.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.6.11/win32/uk/Firefox%20Setup%203.6.11.exe
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = LibreOffice
|
Name = LibreOffice
|
||||||
Version = 3.3.0 Beta 1
|
Version = 3.3.0 Beta 2
|
||||||
Licence = LGPL
|
Licence = LGPL
|
||||||
Description = Former called OpenOffice. Open Source Office Suite.
|
Description = Former called OpenOffice. Open Source Office Suite.
|
||||||
Size = 138.0MB
|
Size = 318.0MB
|
||||||
Category = 6
|
Category = 6
|
||||||
URLSite = http://www.documentfoundation.org/
|
URLSite = http://www.documentfoundation.org/
|
||||||
URLDownload = http://download.documentfoundation.org/libreoffice/testing/LO_3.3.0-beta1_Win_x86_install_en-US.exe
|
URLDownload = http://download.documentfoundation.org/libreoffice/testing/3.3.0-beta2/win/x86/LibO_3.3.0_beta2_Win_x86_install_multi.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = Miranda IM
|
Name = Miranda IM
|
||||||
Version = 0.9.5
|
Version = 0.9.8
|
||||||
Licence = GPL
|
Licence = GPL
|
||||||
Description = Open source multiprotocol instant messaging application - May not work completely.
|
Description = Open source multiprotocol instant messaging application - May not work completely.
|
||||||
Size = 2.2MB
|
Size = 3.0MB
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.miranda-im.org/
|
URLSite = http://www.miranda-im.org/
|
||||||
URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.5-unicode.exe
|
URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.8-unicode.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = mIRC
|
Name = mIRC
|
||||||
Version = 7.1
|
Version = 7.14
|
||||||
Licence = Shareware
|
Licence = Shareware
|
||||||
Description = The most popular client for the Internet Relay Chat (IRC).
|
Description = The most popular client for the Internet Relay Chat (IRC).
|
||||||
Size = 1.8M
|
Size = 2.0M
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.mirc.com/
|
URLSite = http://www.mirc.com/
|
||||||
URLDownload = http://download.mirc.com/mirc71.exe
|
URLDownload = http://download.mirc.com/mirc714.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = Opera
|
Name = Opera
|
||||||
Version = 10.62
|
Version = 10.63
|
||||||
Licence = Freeware
|
Licence = Freeware
|
||||||
Description = The popular Opera Browser with many advanced features and including a Mail and BitTorrent client.
|
Description = The popular Opera Browser with many advanced features and including a Mail and BitTorrent client.
|
||||||
Size = 12.7M
|
Size = 12.7M
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.opera.com/
|
URLSite = http://www.opera.com/
|
||||||
URLDownload = http://get4.opera.com/pub/opera/win/1062/int/Opera_1062_int_Setup.exe
|
URLDownload = http://get4.opera.com/pub/opera/win/1063/int/Opera_1063_int_Setup.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = ScummVM
|
Name = ScummVM
|
||||||
Version = 1.1.1
|
Version = 1.2.0
|
||||||
Licence = GPL
|
Licence = GPL
|
||||||
Description = Sam and Max, Day of the Tentacle, etc on ReactOS.
|
Description = Sam and Max, Day of the Tentacle, etc on ReactOS.
|
||||||
Size = 3.3MB
|
Size = 3.5MB
|
||||||
Category = 4
|
Category = 4
|
||||||
URLSite = http://scummvm.org/
|
URLSite = http://scummvm.org/
|
||||||
URLDownload = http://dfn.dl.sourceforge.net/project/scummvm/scummvm/1.1.1/scummvm-1.1.1-win32.exe
|
URLDownload = http://dfn.dl.sourceforge.net/project/scummvm/scummvm/1.2.0/scummvm-1.2.0-win32.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
|
|
|
@ -2,31 +2,31 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = Mozilla SeaMonkey
|
Name = Mozilla SeaMonkey
|
||||||
Version = 2.0.8
|
Version = 2.0.9
|
||||||
Licence = MPL/GPL/LGPL
|
Licence = MPL/GPL/LGPL
|
||||||
Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need.
|
Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need.
|
||||||
Size = 10.1MB
|
Size = 10.1MB
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.seamonkey-project.org/
|
URLSite = http://www.seamonkey-project.org/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.8/win32/en-US/SeaMonkey%20Setup%202.0.8.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/en-US/SeaMonkey%20Setup%202.0.9.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen.
|
Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen.
|
||||||
Size = 10.0MB
|
Size = 10.0MB
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.8/win32/de/SeaMonkey%20Setup%202.0.8.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/de/SeaMonkey%20Setup%202.0.9.exe
|
||||||
|
|
||||||
[Section.040a]
|
[Section.040a]
|
||||||
Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás.
|
Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás.
|
||||||
Size = 10.0MB
|
Size = 10.0MB
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.8/win32/es-ES/SeaMonkey%20Setup%202.0.8.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/es-ES/SeaMonkey%20Setup%202.0.9.exe
|
||||||
|
|
||||||
[Section.0415]
|
[Section.0415]
|
||||||
Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz.
|
Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz.
|
||||||
Size = 10.8MB
|
Size = 10.8MB
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.8/win32/pl/SeaMonkey%20Setup%202.0.8.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/pl/SeaMonkey%20Setup%202.0.9.exe
|
||||||
|
|
||||||
[Section.0419]
|
[Section.0419]
|
||||||
Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор.
|
Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор.
|
||||||
Size = 10.4MB
|
Size = 10.4MB
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.8/win32/ru/SeaMonkey%20Setup%202.0.8.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.9/win32/ru/SeaMonkey%20Setup%202.0.9.exe
|
||||||
|
|
|
@ -2,41 +2,41 @@
|
||||||
|
|
||||||
[Section]
|
[Section]
|
||||||
Name = Mozilla Thunderbird
|
Name = Mozilla Thunderbird
|
||||||
Version = 3.1.4
|
Version = 3.1.5
|
||||||
Licence = MPL/GPL/LGPL
|
Licence = MPL/GPL/LGPL
|
||||||
Description = The most popular and one of the best free Mail Clients out there.
|
Description = The most popular and one of the best free Mail Clients out there.
|
||||||
Size = 9.0M
|
Size = 9.0M
|
||||||
Category = 5
|
Category = 5
|
||||||
URLSite = http://www.mozilla-europe.org/en/products/thunderbird/
|
URLSite = http://www.mozilla-europe.org/en/products/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/en-US/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/en-US/Thunderbird%20Setup%203.1.5.exe
|
||||||
CDPath = none
|
CDPath = none
|
||||||
|
|
||||||
[Section.0407]
|
[Section.0407]
|
||||||
Description = Der populärste und einer der besten freien Mail-Clients.
|
Description = Der populärste und einer der besten freien Mail-Clients.
|
||||||
Size = 8.8M
|
Size = 8.8M
|
||||||
URLSite = http://www.mozilla-europe.org/de/products/thunderbird/
|
URLSite = http://www.mozilla-europe.org/de/products/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/de/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/de/Thunderbird%20Setup%203.1.5.exe
|
||||||
|
|
||||||
[Section.040a]
|
[Section.040a]
|
||||||
Description = El más popular y uno de los mejores clientes mail que hay.
|
Description = El más popular y uno de los mejores clientes mail que hay.
|
||||||
Size = 8.8M
|
Size = 8.8M
|
||||||
URLSite = http://www.mozilla-europe.org/es/products/thunderbird/
|
URLSite = http://www.mozilla-europe.org/es/products/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/es-ES/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/es-ES/Thunderbird%20Setup%203.1.5.exe
|
||||||
|
|
||||||
[Section.0415]
|
[Section.0415]
|
||||||
Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty.
|
Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty.
|
||||||
Size = 9.7M
|
Size = 9.7M
|
||||||
URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/
|
URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/pl/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/pl/Thunderbird%20Setup%203.1.5.exe
|
||||||
|
|
||||||
[Section.0419]
|
[Section.0419]
|
||||||
Description = Один из самых популярных и лучших бесплатных почтовых клиентов.
|
Description = Один из самых популярных и лучших бесплатных почтовых клиентов.
|
||||||
Size = 9.2M
|
Size = 9.2M
|
||||||
URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/
|
URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/ru/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/ru/Thunderbird%20Setup%203.1.5.exe
|
||||||
|
|
||||||
[Section.0422]
|
[Section.0422]
|
||||||
Description = Найпопулярніший та один з кращих поштових клієнтів.
|
Description = Найпопулярніший та один з кращих поштових клієнтів.
|
||||||
Size = 9.2M
|
Size = 9.2M
|
||||||
URLSite = http://www.mozillamessaging.com/uk/thunderbird/
|
URLSite = http://www.mozillamessaging.com/uk/thunderbird/
|
||||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.4/win32/uk/Thunderbird%20Setup%203.1.4.exe
|
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.5/win32/uk/Thunderbird%20Setup%203.1.5.exe
|
||||||
|
|
|
@ -435,6 +435,12 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
explorer_show_frame(SW_SHOWNORMAL);
|
explorer_show_frame(SW_SHOWNORMAL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_DISPLAYCHANGE:
|
||||||
|
MoveWindow(_hwnd, 0, 0, LOWORD(lparam), HIWORD(lparam), TRUE);
|
||||||
|
MoveWindow(g_Globals._hwndShellView, 0, 0, LOWORD(lparam), HIWORD(lparam), TRUE);
|
||||||
|
MoveWindow(_desktopBar, 0, HIWORD(lparam) - DESKTOPBARBAR_HEIGHT, LOWORD(lparam), DESKTOPBARBAR_HEIGHT, TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_GETISHELLBROWSER:
|
case WM_GETISHELLBROWSER:
|
||||||
return (LRESULT)static_cast<IShellBrowser*>(this);
|
return (LRESULT)static_cast<IShellBrowser*>(this);
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@ typedef struct _SCMGR_HANDLE
|
||||||
typedef struct _MANAGER_HANDLE
|
typedef struct _MANAGER_HANDLE
|
||||||
{
|
{
|
||||||
SCMGR_HANDLE Handle;
|
SCMGR_HANDLE Handle;
|
||||||
|
|
||||||
/* FIXME: Insert more data here */
|
|
||||||
|
|
||||||
WCHAR DatabaseName[1];
|
WCHAR DatabaseName[1];
|
||||||
} MANAGER_HANDLE, *PMANAGER_HANDLE;
|
} MANAGER_HANDLE, *PMANAGER_HANDLE;
|
||||||
|
|
||||||
|
@ -41,11 +38,7 @@ typedef struct _MANAGER_HANDLE
|
||||||
typedef struct _SERVICE_HANDLE
|
typedef struct _SERVICE_HANDLE
|
||||||
{
|
{
|
||||||
SCMGR_HANDLE Handle;
|
SCMGR_HANDLE Handle;
|
||||||
|
|
||||||
PSERVICE ServiceEntry;
|
PSERVICE ServiceEntry;
|
||||||
|
|
||||||
/* FIXME: Insert more data here */
|
|
||||||
|
|
||||||
} SERVICE_HANDLE, *PSERVICE_HANDLE;
|
} SERVICE_HANDLE, *PSERVICE_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +142,7 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
||||||
if (lpDatabaseName == NULL)
|
if (lpDatabaseName == NULL)
|
||||||
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
|
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
|
||||||
|
|
||||||
if (_wcsicmp(lpDatabaseName,SERVICES_FAILED_DATABASEW)==0)
|
if (_wcsicmp(lpDatabaseName, SERVICES_FAILED_DATABASEW) == 0)
|
||||||
{
|
{
|
||||||
DPRINT("Database %S, does not exist\n",lpDatabaseName);
|
DPRINT("Database %S, does not exist\n",lpDatabaseName);
|
||||||
return ERROR_DATABASE_DOES_NOT_EXIST;
|
return ERROR_DATABASE_DOES_NOT_EXIST;
|
||||||
|
@ -168,8 +161,6 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
|
||||||
|
|
||||||
Ptr->Handle.Tag = MANAGER_TAG;
|
Ptr->Handle.Tag = MANAGER_TAG;
|
||||||
|
|
||||||
/* FIXME: initialize more data here */
|
|
||||||
|
|
||||||
wcscpy(Ptr->DatabaseName, lpDatabaseName);
|
wcscpy(Ptr->DatabaseName, lpDatabaseName);
|
||||||
|
|
||||||
*Handle = (SC_HANDLE)Ptr;
|
*Handle = (SC_HANDLE)Ptr;
|
||||||
|
@ -192,7 +183,6 @@ ScmCreateServiceHandle(PSERVICE lpServiceEntry,
|
||||||
|
|
||||||
Ptr->Handle.Tag = SERVICE_TAG;
|
Ptr->Handle.Tag = SERVICE_TAG;
|
||||||
|
|
||||||
/* FIXME: initialize more data here */
|
|
||||||
Ptr->ServiceEntry = lpServiceEntry;
|
Ptr->ServiceEntry = lpServiceEntry;
|
||||||
|
|
||||||
*Handle = (SC_HANDLE)Ptr;
|
*Handle = (SC_HANDLE)Ptr;
|
||||||
|
@ -453,9 +443,10 @@ DWORD RCloseServiceHandle(
|
||||||
if (*hSCObject == 0)
|
if (*hSCObject == 0)
|
||||||
return ERROR_INVALID_HANDLE;
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
hManager = (PMANAGER_HANDLE)*hSCObject;
|
hManager = ScmGetServiceManagerFromHandle(*hSCObject);
|
||||||
hService = (PSERVICE_HANDLE)*hSCObject;
|
hService = ScmGetServiceFromHandle(*hSCObject);
|
||||||
if (hManager->Handle.Tag == MANAGER_TAG)
|
|
||||||
|
if (hManager != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Found manager handle\n");
|
DPRINT("Found manager handle\n");
|
||||||
|
|
||||||
|
@ -467,7 +458,7 @@ DWORD RCloseServiceHandle(
|
||||||
DPRINT("RCloseServiceHandle() done\n");
|
DPRINT("RCloseServiceHandle() done\n");
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (hService->Handle.Tag == SERVICE_TAG)
|
else if (hService != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Found service handle\n");
|
DPRINT("Found service handle\n");
|
||||||
|
|
||||||
|
@ -561,6 +552,8 @@ DWORD RControlService(
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
DWORD dwError = ERROR_SUCCESS;
|
||||||
DWORD pcbBytesNeeded = 0;
|
DWORD pcbBytesNeeded = 0;
|
||||||
DWORD dwServicesReturned = 0;
|
DWORD dwServicesReturned = 0;
|
||||||
|
DWORD dwControlsAccepted;
|
||||||
|
DWORD dwCurrentState;
|
||||||
HKEY hServicesKey = NULL;
|
HKEY hServicesKey = NULL;
|
||||||
|
|
||||||
DPRINT("RControlService() called\n");
|
DPRINT("RControlService() called\n");
|
||||||
|
@ -662,6 +655,49 @@ DWORD RControlService(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dwControlsAccepted = lpService->Status.dwControlsAccepted;
|
||||||
|
dwCurrentState = lpService->Status.dwCurrentState;
|
||||||
|
|
||||||
|
/* Check the current state before sending a control request */
|
||||||
|
switch (dwCurrentState)
|
||||||
|
{
|
||||||
|
case SERVICE_STOP_PENDING:
|
||||||
|
case SERVICE_STOPPED:
|
||||||
|
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||||
|
|
||||||
|
case SERVICE_START_PENDING:
|
||||||
|
switch (dwControl)
|
||||||
|
{
|
||||||
|
case SERVICE_CONTROL_STOP:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_INTERROGATE:
|
||||||
|
RtlCopyMemory(lpServiceStatus,
|
||||||
|
&lpService->Status,
|
||||||
|
sizeof(SERVICE_STATUS));
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ERROR_SERVICE_CANNOT_ACCEPT_CTRL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the control code is acceptable to the service */
|
||||||
|
switch (dwControl)
|
||||||
|
{
|
||||||
|
case SERVICE_CONTROL_STOP:
|
||||||
|
if ((dwControlsAccepted & SERVICE_ACCEPT_STOP) == 0)
|
||||||
|
return ERROR_INVALID_SERVICE_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_CONTROL_PAUSE:
|
||||||
|
case SERVICE_CONTROL_CONTINUE:
|
||||||
|
if ((dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) == 0)
|
||||||
|
return ERROR_INVALID_SERVICE_CONTROL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Send control code to the service */
|
/* Send control code to the service */
|
||||||
dwError = ScmControlService(lpService,
|
dwError = ScmControlService(lpService,
|
||||||
dwControl);
|
dwControl);
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Beep","Type",0x00010001,0x00000001
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ErrorControl",0x00010001,0x00000000
|
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ErrorControl",0x00010001,0x00000000
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Group",0x00000000,"Video Init"
|
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Group",0x00000000,"Video Init"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ImagePath",0x00020000,"system32\drivers\blue.sys"
|
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","ImagePath",0x00020000,"system32\drivers\blue.sys"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Start",0x00010001,0x00000004
|
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Start",0x00010001,0x00000001
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Type",0x00010001,0x00000001
|
HKLM,"SYSTEM\CurrentControlSet\Services\Blue","Type",0x00010001,0x00000001
|
||||||
|
|
||||||
; Cdfs (ISO96660) filesystem driver
|
; Cdfs (ISO96660) filesystem driver
|
||||||
|
|
|
@ -586,6 +586,8 @@ media\fonts\symbol.ttf 3
|
||||||
media\fonts\tahoma.ttf 3
|
media\fonts\tahoma.ttf 3
|
||||||
media\fonts\tahomabd.ttf 3
|
media\fonts\tahomabd.ttf 3
|
||||||
|
|
||||||
|
media\vgafonts\vgafonts.cab 4
|
||||||
|
|
||||||
media\nls\c_037.nls 1
|
media\nls\c_037.nls 1
|
||||||
media\nls\c_424.nls 1
|
media\nls\c_424.nls 1
|
||||||
media\nls\c_500.nls 1
|
media\nls\c_500.nls 1
|
||||||
|
|
|
@ -146,7 +146,7 @@ typedef BOOL (WINAPI *STARTPAGEPRINTER) (HANDLE);
|
||||||
typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
|
typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
|
||||||
typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
|
typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
|
||||||
// Same as ddk/winsplp.h DriverUnloadComplete?
|
// Same as ddk/winsplp.h DriverUnloadComplete?
|
||||||
typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
|
typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
|
||||||
// Driver support:
|
// Driver support:
|
||||||
// DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
|
// DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
|
||||||
typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
|
typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
|
||||||
|
@ -173,10 +173,10 @@ HEAP_strdupA2W(
|
||||||
VOID
|
VOID
|
||||||
HEAP_free(LPVOID memory);
|
HEAP_free(LPVOID memory);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
FONT_TextMetricWToA(
|
FONT_TextMetricWToA(
|
||||||
const TEXTMETRICW *ptmW,
|
const TEXTMETRICW *ptmW,
|
||||||
LPTEXTMETRICA ptmA
|
LPTEXTMETRICA ptmA
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ WINAPI
|
||||||
GdiSetLastError( DWORD dwErrCode );
|
GdiSetLastError( DWORD dwErrCode );
|
||||||
|
|
||||||
DWORD WINAPI GdiGetCodePage(HDC);
|
DWORD WINAPI GdiGetCodePage(HDC);
|
||||||
UINT FASTCALL DIB_BitmapBitsSize( PBITMAPINFO );
|
UINT FASTCALL DIB_BitmapBitsSize( CONST BITMAPINFO* );
|
||||||
|
|
||||||
int
|
int
|
||||||
WINAPI
|
WINAPI
|
||||||
|
|
|
@ -166,6 +166,10 @@ SetPixelFormat(HDC hdc,
|
||||||
INT iPixelFormat,
|
INT iPixelFormat,
|
||||||
CONST PIXELFORMATDESCRIPTOR * ppfd)
|
CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||||
{
|
{
|
||||||
|
/* Can only be set once */
|
||||||
|
INT current = GetPixelFormat(hdc);
|
||||||
|
if(current) return current == iPixelFormat ;
|
||||||
|
|
||||||
if (glSetPixelFormat == NULL)
|
if (glSetPixelFormat == NULL)
|
||||||
if (OpenGLEnable() == FALSE)
|
if (OpenGLEnable() == FALSE)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -34,7 +34,7 @@ DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
FASTCALL
|
FASTCALL
|
||||||
DIB_BitmapBitsSize( PBITMAPINFO Info )
|
DIB_BitmapBitsSize( CONST BITMAPINFO* Info )
|
||||||
{
|
{
|
||||||
UINT Ret;
|
UINT Ret;
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ DIB_BitmapBitsSize( PBITMAPINFO Info )
|
||||||
if ( Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
if ( Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
{
|
{
|
||||||
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
||||||
Ret = Core->bcHeight *
|
Ret = Core->bcHeight *
|
||||||
((Core->bcWidth * Core->bcPlanes * Core->bcBitCount + 31) & ~31 ) / 8;
|
((Core->bcWidth * Core->bcPlanes * Core->bcBitCount + 31) & ~31 ) / 8;
|
||||||
}
|
}
|
||||||
else /* assume BITMAPINFOHEADER */
|
else /* assume BITMAPINFOHEADER */
|
||||||
{
|
{
|
||||||
if ((Info->bmiHeader.biCompression) &&
|
if ((Info->bmiHeader.biCompression) &&
|
||||||
(Info->bmiHeader.biCompression != BI_BITFIELDS))
|
(Info->bmiHeader.biCompression != BI_BITFIELDS))
|
||||||
return Info->bmiHeader.biSizeImage;
|
return Info->bmiHeader.biSizeImage;
|
||||||
// Make Height positive always....
|
// Make Height positive always....
|
||||||
Ret = abs(Info->bmiHeader.biHeight) *
|
Ret = abs(Info->bmiHeader.biHeight) *
|
||||||
((Info->bmiHeader.biWidth * Info->bmiHeader.biPlanes * Info->bmiHeader.biBitCount + 31) & ~31 ) / 8;
|
((Info->bmiHeader.biWidth * Info->bmiHeader.biPlanes * Info->bmiHeader.biBitCount + 31) & ~31 ) / 8;
|
||||||
}
|
}
|
||||||
return Ret;
|
return Ret;
|
||||||
|
@ -132,12 +132,12 @@ WINAPI
|
||||||
GdiGetBitmapBitsSize(BITMAPINFO *lpbmi)
|
GdiGetBitmapBitsSize(BITMAPINFO *lpbmi)
|
||||||
{
|
{
|
||||||
int retSize;
|
int retSize;
|
||||||
|
|
||||||
if (lpbmi->bmiHeader.biSize == FIELD_OFFSET(BITMAPINFOHEADER, biPlanes))
|
if (lpbmi->bmiHeader.biSize == FIELD_OFFSET(BITMAPINFOHEADER, biPlanes))
|
||||||
{
|
{
|
||||||
/* Calc the bits Size and align it*/
|
/* Calc the bits Size and align it*/
|
||||||
retSize = HIWORD(lpbmi->bmiHeader.biWidth) * ((LOWORD(lpbmi->bmiHeader.biWidth) *
|
retSize = HIWORD(lpbmi->bmiHeader.biWidth) * ((LOWORD(lpbmi->bmiHeader.biWidth) *
|
||||||
LOWORD(lpbmi->bmiHeader.biHeight) * HIWORD(lpbmi->bmiHeader.biHeight) + 31)
|
LOWORD(lpbmi->bmiHeader.biHeight) * HIWORD(lpbmi->bmiHeader.biHeight) + 31)
|
||||||
& -32) / 8;
|
& -32) / 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -148,13 +148,13 @@ GdiGetBitmapBitsSize(BITMAPINFO *lpbmi)
|
||||||
if (lpbmi->bmiHeader.biHeight >=0 )
|
if (lpbmi->bmiHeader.biHeight >=0 )
|
||||||
{
|
{
|
||||||
/* Calc the bits Size and align it*/
|
/* Calc the bits Size and align it*/
|
||||||
retSize = lpbmi->bmiHeader.biHeight * ((lpbmi->bmiHeader.biWidth *
|
retSize = lpbmi->bmiHeader.biHeight * ((lpbmi->bmiHeader.biWidth *
|
||||||
lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8;
|
lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Make height postiive if it negitve then calc the bits Size and align it*/
|
/* Make height postiive if it negitve then calc the bits Size and align it*/
|
||||||
retSize = (-lpbmi->bmiHeader.biHeight) * ((lpbmi->bmiHeader.biWidth *
|
retSize = (-lpbmi->bmiHeader.biHeight) * ((lpbmi->bmiHeader.biWidth *
|
||||||
lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8;
|
lpbmi->bmiHeader.biPlanes * lpbmi->bmiHeader.biBitCount + 31) & -32) / 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ CreateDIBSection(
|
||||||
{ // Verify header due to converted may == info.
|
{ // Verify header due to converted may == info.
|
||||||
if ( pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
if ( pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
||||||
{
|
{
|
||||||
if ( pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
if ( pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
||||||
pConvertedInfo->bmiHeader.biCompression == BI_PNG )
|
pConvertedInfo->bmiHeader.biCompression == BI_PNG )
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -319,7 +319,7 @@ CreateBitmapIndirect(const BITMAP *pbm)
|
||||||
(!(pbm->bmWidthBytes & 1)) )
|
(!(pbm->bmWidthBytes & 1)) )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
bitmap = CreateBitmap(pbm->bmWidth,
|
bitmap = CreateBitmap(pbm->bmWidth,
|
||||||
pbm->bmHeight,
|
pbm->bmHeight,
|
||||||
pbm->bmPlanes,
|
pbm->bmPlanes,
|
||||||
|
@ -409,7 +409,7 @@ GetDIBits(
|
||||||
{
|
{
|
||||||
if ( lpbmi->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
if ( lpbmi->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
||||||
{
|
{
|
||||||
if ( lpbmi->bmiHeader.biCompression == BI_JPEG ||
|
if ( lpbmi->bmiHeader.biCompression == BI_JPEG ||
|
||||||
lpbmi->bmiHeader.biCompression == BI_PNG )
|
lpbmi->bmiHeader.biCompression == BI_PNG )
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -461,78 +461,61 @@ CreateDIBitmap( HDC hDC,
|
||||||
LONG width, height, compr, dibsize;
|
LONG width, height, compr, dibsize;
|
||||||
WORD planes, bpp;
|
WORD planes, bpp;
|
||||||
// PDC_ATTR pDc_Attr;
|
// PDC_ATTR pDc_Attr;
|
||||||
PBITMAPINFO pConvertedInfo;
|
UINT InfoSize = 0;
|
||||||
UINT ConvertedInfoSize;
|
UINT cjBmpScanSize = 0;
|
||||||
UINT cjBmpScanSize;
|
|
||||||
PVOID pvSafeBits = NULL;
|
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
if (!Header) return 0;
|
if (!Header) return 0;
|
||||||
|
|
||||||
pConvertedInfo = ConvertBitmapInfo(Data, ColorUse,
|
|
||||||
&ConvertedInfoSize, FALSE);
|
|
||||||
|
|
||||||
if (DIB_GetBitmapInfo(Header, &width, &height, &planes, &bpp, &compr, &dibsize) == -1)
|
if (DIB_GetBitmapInfo(Header, &width, &height, &planes, &bpp, &compr, &dibsize) == -1)
|
||||||
{
|
{
|
||||||
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pConvertedInfo )
|
|
||||||
{
|
|
||||||
if ( pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
|
||||||
{
|
|
||||||
if ( pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
|
||||||
pConvertedInfo->bmiHeader.biCompression == BI_PNG )
|
|
||||||
{
|
|
||||||
hBmp = NULL;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For Icm support.
|
// For Icm support.
|
||||||
// GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
|
// GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
|
||||||
|
|
||||||
cjBmpScanSize = DIB_BitmapBitsSize((LPBITMAPINFO)pConvertedInfo);
|
if(Data)
|
||||||
DPRINT("pBMI %x, Size bpp %d, dibsize %d, Conv %d, BSS %d\n", pConvertedInfo,bpp,dibsize,ConvertedInfoSize,cjBmpScanSize);
|
{
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
cjBmpScanSize = DIB_BitmapBitsSize(Data);
|
||||||
|
CalculateColorTableSize(&Data->bmiHeader, &ColorUse, &InfoSize);
|
||||||
|
InfoSize += Data->bmiHeader.biSize;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("pBMI %x, Size bpp %d, dibsize %d, Conv %d, BSS %d\n", Data,bpp,dibsize,InfoSize,cjBmpScanSize);
|
||||||
|
|
||||||
if ( !width || !height )
|
if ( !width || !height )
|
||||||
hBmp = GetStockObject(DEFAULT_BITMAP);
|
hBmp = GetStockObject(DEFAULT_BITMAP);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( Bits && Init == CBM_INIT )
|
|
||||||
{
|
|
||||||
pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize);
|
|
||||||
if (pvSafeBits == NULL)
|
|
||||||
{
|
|
||||||
hBmp = NULL;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RtlCopyMemory( pvSafeBits, Bits, cjBmpScanSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hBmp = NtGdiCreateDIBitmapInternal(hDC,
|
hBmp = NtGdiCreateDIBitmapInternal(hDC,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
Init,
|
Init,
|
||||||
(LPBYTE)pvSafeBits,
|
(LPBYTE)Bits,
|
||||||
(PBITMAPINFO)pConvertedInfo,
|
(LPBITMAPINFO)Data,
|
||||||
ColorUse,
|
ColorUse,
|
||||||
ConvertedInfoSize,
|
InfoSize,
|
||||||
cjBmpScanSize,
|
cjBmpScanSize,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if ( Bits && Init == CBM_INIT )
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
|
||||||
}
|
}
|
||||||
Exit:
|
|
||||||
if (Data != pConvertedInfo)
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
|
|
||||||
return hBmp;
|
return hBmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +571,7 @@ SetDIBits(HDC hDC,
|
||||||
|
|
||||||
if ( hOldBitmap )
|
if ( hOldBitmap )
|
||||||
{
|
{
|
||||||
if ( hDC )
|
if ( hDC )
|
||||||
hPal = SelectPalette(SavehDC, (HPALETTE)GetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE), FALSE);
|
hPal = SelectPalette(SavehDC, (HPALETTE)GetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE), FALSE);
|
||||||
|
|
||||||
if ( lpbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
|
if ( lpbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
|
||||||
|
@ -782,7 +765,7 @@ SetDIBitsToDevice(
|
||||||
/*
|
/*
|
||||||
if ( !pDc_Attr ||
|
if ( !pDc_Attr ||
|
||||||
((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) &&
|
((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) &&
|
||||||
(pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
(pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
||||||
pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/
|
pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/
|
||||||
{
|
{
|
||||||
LinesCopied = NtGdiSetDIBitsToDeviceInternal( hdc,
|
LinesCopied = NtGdiSetDIBitsToDeviceInternal( hdc,
|
||||||
|
@ -806,7 +789,7 @@ SetDIBitsToDevice(
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
||||||
if (lpbmi != pConvertedInfo)
|
if (lpbmi != pConvertedInfo)
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
|
||||||
|
|
||||||
return LinesCopied;
|
return LinesCopied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,17 +869,12 @@ StretchDIBits(HDC hdc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ( iUsage ) // Save time, we only look at non RGB.
|
pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage,
|
||||||
{
|
&ConvertedInfoSize, FALSE);
|
||||||
pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage,
|
if (!pConvertedInfo)
|
||||||
&ConvertedInfoSize, FALSE);
|
{
|
||||||
if (!pConvertedInfo)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
pConvertedInfo = (PBITMAPINFO)lpBitsInfo;
|
|
||||||
|
|
||||||
cjBmpScanSize = DIB_BitmapBitsSize((LPBITMAPINFO)pConvertedInfo);
|
cjBmpScanSize = DIB_BitmapBitsSize((LPBITMAPINFO)pConvertedInfo);
|
||||||
|
|
||||||
|
@ -933,7 +911,7 @@ StretchDIBits(HDC hdc,
|
||||||
/*
|
/*
|
||||||
if ( !pDc_Attr ||
|
if ( !pDc_Attr ||
|
||||||
((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) &&
|
((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) &&
|
||||||
(pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
(pConvertedInfo->bmiHeader.biCompression == BI_JPEG ||
|
||||||
pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/
|
pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/
|
||||||
{
|
{
|
||||||
LinesCopied = NtGdiStretchDIBitsInternal( hdc,
|
LinesCopied = NtGdiStretchDIBitsInternal( hdc,
|
||||||
|
|
|
@ -15,7 +15,7 @@ IntCreateDICW ( LPCWSTR lpwszDriver,
|
||||||
{
|
{
|
||||||
UNICODE_STRING Device, Output;
|
UNICODE_STRING Device, Output;
|
||||||
HDC hDC = NULL;
|
HDC hDC = NULL;
|
||||||
BOOL Display = FALSE, Default = TRUE;
|
BOOL Display = FALSE, Default = FALSE;
|
||||||
ULONG UMdhpdev = 0;
|
ULONG UMdhpdev = 0;
|
||||||
|
|
||||||
HANDLE hspool = NULL;
|
HANDLE hspool = NULL;
|
||||||
|
@ -31,7 +31,7 @@ IntCreateDICW ( LPCWSTR lpwszDriver,
|
||||||
|
|
||||||
if ((!lpwszDevice) && (!lpwszDriver))
|
if ((!lpwszDevice) && (!lpwszDriver))
|
||||||
{
|
{
|
||||||
Default = FALSE; // Ask Win32k to set Default device.
|
Default = TRUE; // Ask Win32k to set Default device.
|
||||||
Display = TRUE; // Most likely to be DISPLAY.
|
Display = TRUE; // Most likely to be DISPLAY.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -60,7 +60,7 @@ IntCreateDICW ( LPCWSTR lpwszDriver,
|
||||||
DPRINT1("Not a DISPLAY device! %wZ\n", &Device);
|
DPRINT1("Not a DISPLAY device! %wZ\n", &Device);
|
||||||
}
|
}
|
||||||
|
|
||||||
hDC = NtGdiOpenDCW( (Default ? &Device : NULL),
|
hDC = NtGdiOpenDCW( (Default ? NULL : &Device),
|
||||||
(PDEVMODEW) lpInitData,
|
(PDEVMODEW) lpInitData,
|
||||||
(lpwszOutput ? &Output : NULL),
|
(lpwszOutput ? &Output : NULL),
|
||||||
iType, // DCW 0 and ICW 1.
|
iType, // DCW 0 and ICW 1.
|
||||||
|
@ -318,7 +318,7 @@ WINAPI
|
||||||
DeleteObject(HGDIOBJ hObject)
|
DeleteObject(HGDIOBJ hObject)
|
||||||
{
|
{
|
||||||
UINT Type = 0;
|
UINT Type = 0;
|
||||||
|
|
||||||
/* From Wine: DeleteObject does not SetLastError() on a null object */
|
/* From Wine: DeleteObject does not SetLastError() on a null object */
|
||||||
if(!hObject) return FALSE;
|
if(!hObject) return FALSE;
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ DeleteObject(HGDIOBJ hObject)
|
||||||
|
|
||||||
Type = GDI_HANDLE_GET_TYPE(hObject);
|
Type = GDI_HANDLE_GET_TYPE(hObject);
|
||||||
|
|
||||||
if ((Type == GDI_OBJECT_TYPE_METAFILE) ||
|
if ((Type == GDI_OBJECT_TYPE_METAFILE) ||
|
||||||
(Type == GDI_OBJECT_TYPE_ENHMETAFILE))
|
(Type == GDI_OBJECT_TYPE_ENHMETAFILE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ DeleteObject(HGDIOBJ hObject)
|
||||||
case GDI_OBJECT_TYPE_METADC:
|
case GDI_OBJECT_TYPE_METADC:
|
||||||
return MFDRV_DeleteObject( hObject );
|
return MFDRV_DeleteObject( hObject );
|
||||||
case GDI_OBJECT_TYPE_EMF:
|
case GDI_OBJECT_TYPE_EMF:
|
||||||
{
|
{
|
||||||
PLDC pLDC = GdiGetLDC(hObject);
|
PLDC pLDC = GdiGetLDC(hObject);
|
||||||
if ( !pLDC ) return FALSE;
|
if ( !pLDC ) return FALSE;
|
||||||
return EMFDRV_DeleteObject( hObject );
|
return EMFDRV_DeleteObject( hObject );
|
||||||
|
@ -533,7 +533,7 @@ GetDeviceCaps(HDC hDC,
|
||||||
return NtGdiGetDeviceCaps(hDC,i);
|
return NtGdiGetDeviceCaps(hDC,i);
|
||||||
}
|
}
|
||||||
DPRINT("Device CAPS2\n");
|
DPRINT("Device CAPS2\n");
|
||||||
|
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case DRIVERVERSION:
|
case DRIVERVERSION:
|
||||||
|
@ -1603,7 +1603,7 @@ SelectObject(HDC hDC,
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
case GDI_OBJECT_TYPE_METADC:
|
case GDI_OBJECT_TYPE_METADC:
|
||||||
return MFDRV_SelectObject( hDC, hGdiObj);
|
return MFDRV_SelectObject( hDC, hGdiObj);
|
||||||
case GDI_OBJECT_TYPE_EMF:
|
case GDI_OBJECT_TYPE_EMF:
|
||||||
PLDC pLDC = GdiGetLDC(hDC);
|
PLDC pLDC = GdiGetLDC(hDC);
|
||||||
if ( !pLDC ) return NULL;
|
if ( !pLDC ) return NULL;
|
||||||
|
|
|
@ -1,2 +1,12 @@
|
||||||
HCURSOR
|
HCURSOR
|
||||||
CursorIconToCursor(HICON hIcon, BOOL SemiTransparent);
|
CursorIconToCursor(HICON hIcon,
|
||||||
|
BOOL SemiTransparent);
|
||||||
|
|
||||||
|
HICON CreateCursorIconFromData(PVOID ImageData,
|
||||||
|
ICONIMAGE* IconImage,
|
||||||
|
int cxDesired,
|
||||||
|
int cyDesired,
|
||||||
|
int xHotspot,
|
||||||
|
int yHotspot,
|
||||||
|
BOOL fIcon);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
#include <pseh/pseh2.h>
|
#include <pseh/pseh2.h>
|
||||||
|
|
||||||
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
|
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
|
||||||
#define ISITHOOKED(HookId) (GetWin32ClientInfo()->fsHooks & HOOKID_TO_FLAG(HookId))
|
#define ISITHOOKED(HookId) (GetWin32ClientInfo()->fsHooks & HOOKID_TO_FLAG(HookId) ||\
|
||||||
|
(GetWin32ClientInfo()->pDeskInfo && GetWin32ClientInfo()->pDeskInfo->fsHooks & HOOKID_TO_FLAG(HookId)))
|
||||||
|
|
||||||
/* Temporarily in here for now. */
|
/* Temporarily in here for now. */
|
||||||
typedef struct _USERAPIHOOKINFO
|
typedef struct _USERAPIHOOKINFO
|
||||||
|
@ -168,7 +169,7 @@ SharedPtrToKernel(PVOID Ptr)
|
||||||
static __inline BOOL
|
static __inline BOOL
|
||||||
IsThreadHooked(PCLIENTINFO pci)
|
IsThreadHooked(PCLIENTINFO pci)
|
||||||
{
|
{
|
||||||
return pci->fsHooks != 0;
|
return (pci->fsHooks|pci->pDeskInfo->fsHooks) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline PDESKTOPINFO
|
static __inline PDESKTOPINFO
|
||||||
|
@ -194,3 +195,4 @@ VOID FASTCALL GetConnected(VOID);
|
||||||
BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi);
|
BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi);
|
||||||
BOOL FASTCALL TestWindowProcess(PWND);
|
BOOL FASTCALL TestWindowProcess(PWND);
|
||||||
VOID UserGetWindowBorders(DWORD, DWORD, SIZE *, BOOL);
|
VOID UserGetWindowBorders(DWORD, DWORD, SIZE *, BOOL);
|
||||||
|
VOID FASTCALL IntNotifyWinEvent(DWORD, HWND, LONG, LONG, DWORD);
|
||||||
|
|
|
@ -83,9 +83,6 @@
|
||||||
#define NtUserGetCursorPos(lpPoint) \
|
#define NtUserGetCursorPos(lpPoint) \
|
||||||
(BOOL)NtUserCallOneParam((DWORD_PTR)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
|
(BOOL)NtUserCallOneParam((DWORD_PTR)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
|
||||||
|
|
||||||
#define NtUserIsWindowInDestroy(hWnd) \
|
|
||||||
(BOOL)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_ISWINDOWINDESTROY)
|
|
||||||
|
|
||||||
#define NtUserEnableProcessWindowGhosting(bEnable) \
|
#define NtUserEnableProcessWindowGhosting(bEnable) \
|
||||||
NtUserCallOneParam((DWORD_PTR)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
|
NtUserCallOneParam((DWORD_PTR)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,6 @@ ChangeDisplaySettingsExA(
|
||||||
LONG rc;
|
LONG rc;
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
PUNICODE_STRING pDeviceName = &DeviceName;
|
PUNICODE_STRING pDeviceName = &DeviceName;
|
||||||
LPDEVMODEW pDevModeW;
|
|
||||||
|
|
||||||
if (lpszDeviceName != NULL)
|
if (lpszDeviceName != NULL)
|
||||||
{
|
{
|
||||||
|
@ -471,14 +470,19 @@ ChangeDisplaySettingsExA(
|
||||||
pDeviceName = NULL;
|
pDeviceName = NULL;
|
||||||
|
|
||||||
if (lpDevMode != NULL)
|
if (lpDevMode != NULL)
|
||||||
|
{
|
||||||
|
LPDEVMODEW pDevModeW;
|
||||||
pDevModeW = GdiConvertToDevmodeW(lpDevMode);
|
pDevModeW = GdiConvertToDevmodeW(lpDevMode);
|
||||||
|
if(pDevModeW)
|
||||||
|
{
|
||||||
|
rc = NtUserChangeDisplaySettings ( pDeviceName, pDevModeW, hwnd, dwflags, lParam );
|
||||||
|
RtlFreeHeap(GetProcessHeap(), 0, pDevModeW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = DISP_CHANGE_SUCCESSFUL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pDevModeW = NULL;
|
rc = NtUserChangeDisplaySettings ( pDeviceName, NULL, hwnd, dwflags, lParam );
|
||||||
|
|
||||||
rc = NtUserChangeDisplaySettings ( pDeviceName, pDevModeW, hwnd, dwflags, lParam );
|
|
||||||
|
|
||||||
if (pDevModeW != NULL)
|
|
||||||
RtlFreeHeap(GetProcessHeap(), 0, pDevModeW);
|
|
||||||
|
|
||||||
if (lpszDeviceName != NULL)
|
if (lpszDeviceName != NULL)
|
||||||
RtlFreeUnicodeString ( &DeviceName );
|
RtlFreeUnicodeString ( &DeviceName );
|
||||||
|
@ -539,6 +543,6 @@ ChangeDisplaySettingsW(
|
||||||
DWORD dwflags)
|
DWORD dwflags)
|
||||||
{
|
{
|
||||||
if(lpDevMode)
|
if(lpDevMode)
|
||||||
lpDevMode->dmDriverExtra = 0;
|
lpDevMode->dmDriverExtra = 0;
|
||||||
return ChangeDisplaySettingsExW ( NULL, lpDevMode, NULL, dwflags, 0 );
|
return ChangeDisplaySettingsExW ( NULL, lpDevMode, NULL, dwflags, 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,13 +304,13 @@ GetUser32Handle(HANDLE handle)
|
||||||
static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_EVENT + 1] =
|
static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_EVENT + 1] =
|
||||||
{
|
{
|
||||||
FALSE, /* VALIDATE_TYPE_FREE (not used) */
|
FALSE, /* VALIDATE_TYPE_FREE (not used) */
|
||||||
FALSE, /* VALIDATE_TYPE_WIN FALSE */
|
FALSE, /* VALIDATE_TYPE_WIN */
|
||||||
TRUE, /* VALIDATE_TYPE_MENU FALSE */
|
TRUE, /* VALIDATE_TYPE_MENU FALSE */
|
||||||
TRUE, /* VALIDATE_TYPE_CURSOR */
|
TRUE, /* VALIDATE_TYPE_CURSOR */
|
||||||
TRUE, /* VALIDATE_TYPE_MWPOS */
|
TRUE, /* VALIDATE_TYPE_MWPOS */
|
||||||
TRUE, /* VALIDATE_TYPE_HOOK FALSE */
|
FALSE, /* VALIDATE_TYPE_HOOK */
|
||||||
FALSE, /* (not used) */
|
FALSE, /* (not used) */
|
||||||
TRUE, /* VALIDATE_TYPE_CALLPROC FALSE */
|
FALSE, /* VALIDATE_TYPE_CALLPROC */
|
||||||
TRUE, /* VALIDATE_TYPE_ACCEL */
|
TRUE, /* VALIDATE_TYPE_ACCEL */
|
||||||
FALSE, /* (not used) */
|
FALSE, /* (not used) */
|
||||||
FALSE, /* (not used) */
|
FALSE, /* (not used) */
|
||||||
|
|
|
@ -298,7 +298,7 @@ IntGetWndProc(PWND pWnd, BOOL Ansi)
|
||||||
}
|
}
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
// Wine Class tests:
|
// Wine Class tests:
|
||||||
/* Edit controls are special - they return a wndproc handle when
|
/* Edit controls are special - they return a wndproc handle when
|
||||||
GetWindowLongPtr is called with a different A/W.
|
GetWindowLongPtr is called with a different A/W.
|
||||||
On the other hand there is no W->A->W conversion so this control
|
On the other hand there is no W->A->W conversion so this control
|
||||||
|
@ -831,7 +831,6 @@ CreateSmallIcon(HICON StdIcon)
|
||||||
int SmallIconWidth;
|
int SmallIconWidth;
|
||||||
int SmallIconHeight;
|
int SmallIconHeight;
|
||||||
BITMAP StdBitmapInfo;
|
BITMAP StdBitmapInfo;
|
||||||
HDC hInfoDc = NULL;
|
|
||||||
HDC hSourceDc = NULL;
|
HDC hSourceDc = NULL;
|
||||||
HDC hDestDc = NULL;
|
HDC hDestDc = NULL;
|
||||||
ICONINFO SmallInfo;
|
ICONINFO SmallInfo;
|
||||||
|
@ -867,15 +866,6 @@ CreateSmallIcon(HICON StdIcon)
|
||||||
return StdIcon;
|
return StdIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a handle to a info DC and handles to DCs which can be used to
|
|
||||||
select a bitmap into. This is done to avoid triggering a switch to
|
|
||||||
graphics mode (if we're currently in text/blue screen mode) */
|
|
||||||
hInfoDc = CreateICW(NULL, NULL, NULL, NULL);
|
|
||||||
if (NULL == hInfoDc)
|
|
||||||
{
|
|
||||||
ERR("Failed to create info DC\n");
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
hSourceDc = CreateCompatibleDC(NULL);
|
hSourceDc = CreateCompatibleDC(NULL);
|
||||||
if (NULL == hSourceDc)
|
if (NULL == hSourceDc)
|
||||||
{
|
{
|
||||||
|
@ -895,7 +885,7 @@ CreateSmallIcon(HICON StdIcon)
|
||||||
ERR("Failed to select source color bitmap\n");
|
ERR("Failed to select source color bitmap\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
SmallInfo.hbmColor = CreateCompatibleBitmap(hInfoDc, SmallIconWidth,
|
SmallInfo.hbmColor = CreateCompatibleBitmap(hSourceDc, SmallIconWidth,
|
||||||
SmallIconHeight);
|
SmallIconHeight);
|
||||||
if (NULL == SmallInfo.hbmColor)
|
if (NULL == SmallInfo.hbmColor)
|
||||||
{
|
{
|
||||||
|
@ -921,8 +911,7 @@ CreateSmallIcon(HICON StdIcon)
|
||||||
ERR("Failed to select source mask bitmap\n");
|
ERR("Failed to select source mask bitmap\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
SmallInfo.hbmMask = CreateBitmap(SmallIconWidth, SmallIconHeight, 1, 1,
|
SmallInfo.hbmMask = CreateCompatibleBitmap(hSourceDc, SmallIconWidth, SmallIconHeight);
|
||||||
NULL);
|
|
||||||
if (NULL == SmallInfo.hbmMask)
|
if (NULL == SmallInfo.hbmMask)
|
||||||
{
|
{
|
||||||
ERR("Failed to create mask bitmap\n");
|
ERR("Failed to create mask bitmap\n");
|
||||||
|
@ -976,10 +965,6 @@ cleanup:
|
||||||
{
|
{
|
||||||
DeleteDC(hSourceDc);
|
DeleteDC(hSourceDc);
|
||||||
}
|
}
|
||||||
if (NULL != hInfoDc)
|
|
||||||
{
|
|
||||||
DeleteDC(hInfoDc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SmallIcon;
|
return SmallIcon;
|
||||||
}
|
}
|
||||||
|
@ -1070,9 +1055,9 @@ RegisterClassExWOWW(WNDCLASSEXW *lpwcx,
|
||||||
clsMenuName.pszClientAnsiMenuName = AnsiMenuName.Buffer;
|
clsMenuName.pszClientAnsiMenuName = AnsiMenuName.Buffer;
|
||||||
clsMenuName.pwszClientUnicodeMenuName = MenuName.Buffer;
|
clsMenuName.pwszClientUnicodeMenuName = MenuName.Buffer;
|
||||||
clsMenuName.pusMenuName = &MenuName;
|
clsMenuName.pusMenuName = &MenuName;
|
||||||
|
|
||||||
Atom = NtUserRegisterClassExWOW( &WndClass,
|
Atom = NtUserRegisterClassExWOW( &WndClass,
|
||||||
&ClassName,
|
&ClassName,
|
||||||
NULL, //PUNICODE_STRING ClsNVersion,
|
NULL, //PUNICODE_STRING ClsNVersion,
|
||||||
&clsMenuName,
|
&clsMenuName,
|
||||||
fnID,
|
fnID,
|
||||||
|
|
|
@ -458,10 +458,16 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
||||||
void *color_bits, *mask_bits;
|
void *color_bits, *mask_bits;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
HDC hdc = 0;
|
HDC hdc = 0;
|
||||||
|
static HDC hScreenDC = 0;
|
||||||
|
|
||||||
if (!(info = HeapAlloc( GetProcessHeap(), 0, max( size, FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))))
|
if (!(info = HeapAlloc( GetProcessHeap(), 0, max( size, FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!(hdc = CreateCompatibleDC( 0 ))) goto done;
|
if(!hScreenDC)
|
||||||
|
{
|
||||||
|
hScreenDC = GetDC(0);
|
||||||
|
if(!hScreenDC) goto done;
|
||||||
|
}
|
||||||
|
if (!(hdc = CreateCompatibleDC(hScreenDC))) goto done;
|
||||||
|
|
||||||
memcpy( info, bmi, size );
|
memcpy( info, bmi, size );
|
||||||
info->bmiHeader.biHeight /= 2;
|
info->bmiHeader.biHeight /= 2;
|
||||||
|
@ -485,8 +491,8 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(*mask = CreateBitmap( width, height, 1, 1, NULL ))) goto done;
|
if (!(*mask = CreateBitmap( width, height, 1, 1, NULL ))) goto done;
|
||||||
if (!(*color = CreateBitmap( width, height, bmi->bmiHeader.biPlanes,
|
if (!(*color = CreateBitmap( width, height, GetDeviceCaps(hScreenDC, PLANES),
|
||||||
bmi->bmiHeader.biBitCount, NULL )))
|
GetDeviceCaps(hScreenDC, BITSPIXEL), NULL )))
|
||||||
{
|
{
|
||||||
DeleteObject( *mask );
|
DeleteObject( *mask );
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -523,7 +529,7 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height,
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
DeleteDC( hdc );
|
if(hdc) DeleteDC( hdc );
|
||||||
HeapFree( GetProcessHeap(), 0, info );
|
HeapFree( GetProcessHeap(), 0, info );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ BOOL
|
||||||
FASTCALL
|
FASTCALL
|
||||||
DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
|
DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
|
||||||
{
|
{
|
||||||
|
BOOL Ret;
|
||||||
LARGE_STRING lsString;
|
LARGE_STRING lsString;
|
||||||
|
|
||||||
if ( String )
|
if ( String )
|
||||||
|
@ -112,7 +113,12 @@ DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
|
||||||
else
|
else
|
||||||
RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)&lsString, String, 0);
|
RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)&lsString, String, 0);
|
||||||
}
|
}
|
||||||
return NtUserDefSetText(hWnd, (String ? &lsString : NULL));
|
Ret = NtUserDefSetText(hWnd, (String ? &lsString : NULL));
|
||||||
|
|
||||||
|
if (Ret)
|
||||||
|
IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, hWnd, OBJID_WINDOW, CHILDID_SELF, 0);
|
||||||
|
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1969,7 +1975,6 @@ RealDefWindowProcA(HWND hWnd,
|
||||||
{
|
{
|
||||||
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
DefWndNCPaint(hWnd, (HRGN)1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result = 1;
|
Result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1373,9 +1373,9 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DSS_DISABLED)
|
if (flags & DSS_DISABLED)
|
||||||
hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));
|
hbrtmp = GetSysColorBrush(COLOR_3DHILIGHT);
|
||||||
else if (flags & DSS_DEFAULT)
|
else if (flags & DSS_DEFAULT)
|
||||||
hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
|
hbrtmp = GetSysColorBrush(COLOR_3DSHADOW);
|
||||||
|
|
||||||
/* Draw light or dark shadow */
|
/* Draw light or dark shadow */
|
||||||
if (flags & (DSS_DISABLED|DSS_DEFAULT))
|
if (flags & (DSS_DISABLED|DSS_DEFAULT))
|
||||||
|
@ -1388,13 +1388,11 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A))
|
if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
SelectObject(hdc, hbsave);
|
SelectObject(hdc, hbsave);
|
||||||
DeleteObject(hbrtmp);
|
|
||||||
hbrtmp = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DSS_DISABLED)
|
if (flags & DSS_DISABLED)
|
||||||
{
|
{
|
||||||
hbr = hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
|
hbr = hbrtmp = GetSysColorBrush(COLOR_3DSHADOW);
|
||||||
if(!hbrtmp)
|
if(!hbrtmp)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -1418,8 +1416,6 @@ cleanup:
|
||||||
SelectObject(hdc, hbsave);
|
SelectObject(hdc, hbsave);
|
||||||
if(hbmsave)
|
if(hbmsave)
|
||||||
SelectObject(memdc, hbmsave);
|
SelectObject(memdc, hbmsave);
|
||||||
if(hbrtmp)
|
|
||||||
DeleteObject(hbrtmp);
|
|
||||||
if(hbm)
|
if(hbm)
|
||||||
DeleteObject(hbm);
|
DeleteObject(hbm);
|
||||||
if(memdc)
|
if(memdc)
|
||||||
|
|
|
@ -34,6 +34,14 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
||||||
|
|
||||||
|
typedef struct _NOTIFYEVENT
|
||||||
|
{
|
||||||
|
DWORD event;
|
||||||
|
LONG idObject;
|
||||||
|
LONG idChild;
|
||||||
|
DWORD flags;
|
||||||
|
} NOTIFYEVENT, *PNOTIFYEVENT;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -99,6 +107,29 @@ IntSetWindowsHook(
|
||||||
return NtUserSetWindowsHookEx(hMod, &USModuleName, dwThreadId, idHook, lpfn, bAnsi);
|
return NtUserSetWindowsHookEx(hMod, &USModuleName, dwThreadId, idHook, lpfn, bAnsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Since ReactOS uses User32 as the main message source this was needed.
|
||||||
|
Base on the funny rules from the wine tests it left it with this option.
|
||||||
|
8^(
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
IntNotifyWinEvent(
|
||||||
|
DWORD event,
|
||||||
|
HWND hwnd,
|
||||||
|
LONG idObject,
|
||||||
|
LONG idChild,
|
||||||
|
DWORD flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NOTIFYEVENT ne;
|
||||||
|
ne.event = event;
|
||||||
|
ne.idObject = idObject;
|
||||||
|
ne.idChild = idChild;
|
||||||
|
ne.flags = flags;
|
||||||
|
if (gpsi->dwInstalledEventHooks & GetMaskFromEvent(event))
|
||||||
|
NtUserCallHwndParam(hwnd, (DWORD)&ne, HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT);
|
||||||
|
}
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
@ -195,7 +226,7 @@ CallNextHookEx(
|
||||||
{
|
{
|
||||||
PCLIENTINFO ClientInfo;
|
PCLIENTINFO ClientInfo;
|
||||||
DWORD Flags, Save;
|
DWORD Flags, Save;
|
||||||
PHOOK pHook;
|
PHOOK pHook, phkNext;
|
||||||
LRESULT lResult = 0;
|
LRESULT lResult = 0;
|
||||||
|
|
||||||
GetConnected();
|
GetConnected();
|
||||||
|
@ -204,9 +235,14 @@ CallNextHookEx(
|
||||||
|
|
||||||
if (!ClientInfo->phkCurrent) return 0;
|
if (!ClientInfo->phkCurrent) return 0;
|
||||||
|
|
||||||
pHook = SharedPtrToUser(ClientInfo->phkCurrent);
|
pHook = DesktopPtrToUser(ClientInfo->phkCurrent);
|
||||||
|
|
||||||
if (pHook->HookId == WH_CALLWNDPROC || pHook->HookId == WH_CALLWNDPROCRET)
|
if (!pHook->phkNext) return 0; // Nothing to do....
|
||||||
|
|
||||||
|
phkNext = DesktopPtrToUser(pHook->phkNext);
|
||||||
|
|
||||||
|
if ( phkNext->HookId == WH_CALLWNDPROC ||
|
||||||
|
phkNext->HookId == WH_CALLWNDPROCRET)
|
||||||
{
|
{
|
||||||
Save = ClientInfo->dwHookData;
|
Save = ClientInfo->dwHookData;
|
||||||
Flags = ClientInfo->CI_flags & CI_CURTHPRHOOK;
|
Flags = ClientInfo->CI_flags & CI_CURTHPRHOOK;
|
||||||
|
@ -215,7 +251,7 @@ CallNextHookEx(
|
||||||
if (wParam) ClientInfo->CI_flags |= CI_CURTHPRHOOK;
|
if (wParam) ClientInfo->CI_flags |= CI_CURTHPRHOOK;
|
||||||
else ClientInfo->CI_flags &= ~CI_CURTHPRHOOK;
|
else ClientInfo->CI_flags &= ~CI_CURTHPRHOOK;
|
||||||
|
|
||||||
if (pHook->HookId == WH_CALLWNDPROC)
|
if (phkNext->HookId == WH_CALLWNDPROC)
|
||||||
{
|
{
|
||||||
PCWPSTRUCT pCWP = (PCWPSTRUCT)lParam;
|
PCWPSTRUCT pCWP = (PCWPSTRUCT)lParam;
|
||||||
|
|
||||||
|
@ -225,7 +261,7 @@ CallNextHookEx(
|
||||||
pCWP->lParam,
|
pCWP->lParam,
|
||||||
(ULONG_PTR)&lResult,
|
(ULONG_PTR)&lResult,
|
||||||
FNID_CALLWNDPROC,
|
FNID_CALLWNDPROC,
|
||||||
pHook->Ansi);
|
phkNext->Ansi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -239,7 +275,7 @@ CallNextHookEx(
|
||||||
pCWPR->lParam,
|
pCWPR->lParam,
|
||||||
(ULONG_PTR)&lResult,
|
(ULONG_PTR)&lResult,
|
||||||
FNID_CALLWNDPROCRET,
|
FNID_CALLWNDPROCRET,
|
||||||
pHook->Ansi);
|
phkNext->Ansi);
|
||||||
}
|
}
|
||||||
ClientInfo->CI_flags ^= ((ClientInfo->CI_flags ^ Flags) & CI_CURTHPRHOOK);
|
ClientInfo->CI_flags ^= ((ClientInfo->CI_flags ^ Flags) & CI_CURTHPRHOOK);
|
||||||
ClientInfo->dwHookData = Save;
|
ClientInfo->dwHookData = Save;
|
||||||
|
@ -252,23 +288,27 @@ CallNextHookEx(
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
HHOOK
|
HHOOK
|
||||||
WINAPI
|
WINAPI
|
||||||
SetWindowsHookW(int idHook, HOOKPROC lpfn)
|
SetWindowsHookW(int idHook, HOOKPROC lpfn)
|
||||||
{
|
{
|
||||||
return IntSetWindowsHook(idHook, lpfn, NULL, 0, FALSE);
|
DWORD ThreadId = PtrToUint(NtCurrentTeb()->ClientId.UniqueThread);
|
||||||
|
return IntSetWindowsHook(idHook, lpfn, NULL, ThreadId, FALSE);
|
||||||
|
// return NtUserSetWindowsHookAW(idHook, lpfn, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
HHOOK
|
HHOOK
|
||||||
WINAPI
|
WINAPI
|
||||||
SetWindowsHookA(int idHook, HOOKPROC lpfn)
|
SetWindowsHookA(int idHook, HOOKPROC lpfn)
|
||||||
{
|
{
|
||||||
return IntSetWindowsHook(idHook, lpfn, NULL, 0, TRUE);
|
DWORD ThreadId = PtrToUint(NtCurrentTeb()->ClientId.UniqueThread);
|
||||||
|
return IntSetWindowsHook(idHook, lpfn, NULL, ThreadId, TRUE);
|
||||||
|
// return NtUserSetWindowsHookAW(idHook, lpfn, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -377,7 +417,7 @@ IsWinEventHookInstalled(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
HHOOK
|
HHOOK
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -392,7 +432,7 @@ SetWindowsHookExA(
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
HHOOK
|
HHOOK
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -409,22 +449,21 @@ NTSTATUS WINAPI
|
||||||
User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
{
|
{
|
||||||
PHOOKPROC_CALLBACK_ARGUMENTS Common;
|
PHOOKPROC_CALLBACK_ARGUMENTS Common;
|
||||||
LRESULT Result;
|
|
||||||
CREATESTRUCTW Csw;
|
CREATESTRUCTW Csw;
|
||||||
CBT_CREATEWNDW CbtCreatewndw;
|
CBT_CREATEWNDW CbtCreatewndw;
|
||||||
CREATESTRUCTA Csa;
|
|
||||||
CBT_CREATEWNDA CbtCreatewnda;
|
|
||||||
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
|
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
|
||||||
WPARAM wParam = 0;
|
KBDLLHOOKSTRUCT KeyboardLlData, *pKeyboardLlData;
|
||||||
LPARAM lParam = 0;
|
MSLLHOOKSTRUCT MouseLlData, *pMouseLlData;
|
||||||
PKBDLLHOOKSTRUCT KeyboardLlData;
|
MSG Msg, *pMsg;
|
||||||
PMSLLHOOKSTRUCT MouseLlData;
|
PMOUSEHOOKSTRUCT pMHook;
|
||||||
PMSG Msg;
|
CWPSTRUCT CWP, *pCWP;
|
||||||
PMOUSEHOOKSTRUCT MHook;
|
CWPRETSTRUCT CWPR, *pCWPR;
|
||||||
PCWPSTRUCT CWP;
|
|
||||||
PCWPRETSTRUCT CWPR;
|
|
||||||
PRECTL prl;
|
PRECTL prl;
|
||||||
LPCBTACTIVATESTRUCT pcbtas;
|
LPCBTACTIVATESTRUCT pcbtas;
|
||||||
|
WPARAM wParam = 0;
|
||||||
|
LPARAM lParam = 0;
|
||||||
|
LRESULT Result = 0;
|
||||||
|
BOOL Hit = FALSE;
|
||||||
|
|
||||||
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Arguments;
|
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Arguments;
|
||||||
|
|
||||||
|
@ -438,34 +477,16 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS)
|
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS)
|
||||||
((PCHAR) Common + Common->lParam);
|
((PCHAR) Common + Common->lParam);
|
||||||
Csw = CbtCreatewndExtra->Cs;
|
Csw = CbtCreatewndExtra->Cs;
|
||||||
if (NULL != CbtCreatewndExtra->Cs.lpszName)
|
Csw.lpszName = CbtCreatewndExtra->Cs.lpszName;
|
||||||
{
|
Csw.lpszClass = CbtCreatewndExtra->Cs.lpszClass;
|
||||||
Csw.lpszName = (LPCWSTR)((PCHAR) CbtCreatewndExtra
|
|
||||||
+ (ULONG_PTR) CbtCreatewndExtra->Cs.lpszName);
|
|
||||||
}
|
|
||||||
if (0 != HIWORD(CbtCreatewndExtra->Cs.lpszClass))
|
|
||||||
{
|
|
||||||
Csw.lpszClass = (LPCWSTR)((PCHAR) CbtCreatewndExtra
|
|
||||||
+ LOWORD((ULONG_PTR) CbtCreatewndExtra->Cs.lpszClass));
|
|
||||||
}
|
|
||||||
wParam = Common->wParam;
|
wParam = Common->wParam;
|
||||||
if (Common->Ansi)
|
CbtCreatewndw.lpcs = &Csw;
|
||||||
{
|
CbtCreatewndw.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
|
||||||
memcpy(&Csa, &Csw, sizeof(CREATESTRUCTW));
|
lParam = (LPARAM) &CbtCreatewndw;
|
||||||
CbtCreatewnda.lpcs = &Csa;
|
|
||||||
CbtCreatewnda.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
|
|
||||||
lParam = (LPARAM) &CbtCreatewnda;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CbtCreatewndw.lpcs = &Csw;
|
|
||||||
CbtCreatewndw.hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
|
|
||||||
lParam = (LPARAM) &CbtCreatewndw;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case HCBT_CLICKSKIPPED:
|
case HCBT_CLICKSKIPPED:
|
||||||
MHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
pMHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
lParam = (LPARAM) MHook;
|
lParam = (LPARAM) pMHook;
|
||||||
break;
|
break;
|
||||||
case HCBT_MOVESIZE:
|
case HCBT_MOVESIZE:
|
||||||
prl = (PRECTL)((PCHAR) Common + Common->lParam);
|
prl = (PRECTL)((PCHAR) Common + Common->lParam);
|
||||||
|
@ -475,7 +496,7 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
pcbtas = (LPCBTACTIVATESTRUCT)((PCHAR) Common + Common->lParam);
|
pcbtas = (LPCBTACTIVATESTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
lParam = (LPARAM) pcbtas;
|
lParam = (LPARAM) pcbtas;
|
||||||
break;
|
break;
|
||||||
case HCBT_KEYSKIPPED:
|
case HCBT_KEYSKIPPED: /* The rest SEH support */
|
||||||
case HCBT_MINMAX:
|
case HCBT_MINMAX:
|
||||||
case HCBT_SETFOCUS:
|
case HCBT_SETFOCUS:
|
||||||
case HCBT_SYSCOMMAND:
|
case HCBT_SYSCOMMAND:
|
||||||
|
@ -490,7 +511,17 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Common->Proc)
|
if (Common->Proc)
|
||||||
Result = Common->Proc(Common->Code, wParam, lParam);
|
{
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
Result = Common->Proc(Common->Code, wParam, lParam);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Hit = TRUE;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERR("Common = 0x%x, Proc = 0x%x\n",Common,Common->Proc);
|
ERR("Common = 0x%x, Proc = 0x%x\n",Common,Common->Proc);
|
||||||
|
@ -499,46 +530,86 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
|
||||||
{
|
{
|
||||||
case HCBT_CREATEWND:
|
case HCBT_CREATEWND:
|
||||||
CbtCreatewndExtra->WndInsertAfter = CbtCreatewndw.hwndInsertAfter;
|
CbtCreatewndExtra->WndInsertAfter = CbtCreatewndw.hwndInsertAfter;
|
||||||
|
CbtCreatewndExtra->Cs.x = CbtCreatewndw.lpcs->x;
|
||||||
|
CbtCreatewndExtra->Cs.y = CbtCreatewndw.lpcs->y;
|
||||||
|
CbtCreatewndExtra->Cs.cx = CbtCreatewndw.lpcs->cx;
|
||||||
|
CbtCreatewndExtra->Cs.cy = CbtCreatewndw.lpcs->cy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WH_KEYBOARD_LL:
|
case WH_KEYBOARD_LL:
|
||||||
KeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
ERR("WH_KEYBOARD_LL: Code %d, wParam %d\n",Common->Code,Common->wParam);
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) KeyboardLlData);
|
pKeyboardLlData = (PKBDLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
|
RtlCopyMemory(&KeyboardLlData, pKeyboardLlData, sizeof(KBDLLHOOKSTRUCT));
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &KeyboardLlData);
|
||||||
break;
|
break;
|
||||||
case WH_MOUSE_LL:
|
case WH_MOUSE_LL:
|
||||||
MouseLlData = (PMSLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
pMouseLlData = (PMSLLHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) MouseLlData);
|
RtlCopyMemory(&MouseLlData, pMouseLlData, sizeof(MSLLHOOKSTRUCT));
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &MouseLlData);
|
||||||
break;
|
break;
|
||||||
case WH_MOUSE:
|
case WH_MOUSE: /* SEH support */
|
||||||
MHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
pMHook = (PMOUSEHOOKSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) MHook);
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) pMHook);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Hit = TRUE;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
break;
|
break;
|
||||||
case WH_CALLWNDPROC:
|
case WH_CALLWNDPROC:
|
||||||
CWP = (PCWPSTRUCT)((PCHAR) Common + Common->lParam);
|
ERR("WH_CALLWNDPROC: Code %d, wParam %d\n",Common->Code,Common->wParam);
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) CWP);
|
pCWP = (PCWPSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
|
RtlCopyMemory(&CWP, pCWP, sizeof(CWPSTRUCT));
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &CWP);
|
||||||
break;
|
break;
|
||||||
case WH_CALLWNDPROCRET:
|
case WH_CALLWNDPROCRET:
|
||||||
CWPR = (PCWPRETSTRUCT)((PCHAR) Common + Common->lParam);
|
pCWPR = (PCWPRETSTRUCT)((PCHAR) Common + Common->lParam);
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) CWPR);
|
RtlCopyMemory(&CWPR, pCWPR, sizeof(CWPRETSTRUCT));
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &CWPR);
|
||||||
break;
|
break;
|
||||||
case WH_MSGFILTER:
|
case WH_MSGFILTER: /* All SEH support */
|
||||||
|
ERR("WH_MSGFILTER: Code %d, wParam %d\n",Common->Code,Common->wParam);
|
||||||
case WH_SYSMSGFILTER:
|
case WH_SYSMSGFILTER:
|
||||||
case WH_GETMESSAGE:
|
case WH_GETMESSAGE:
|
||||||
Msg = (PMSG)((PCHAR) Common + Common->lParam);
|
pMsg = (PMSG)((PCHAR) Common + Common->lParam);
|
||||||
// FIXME("UHOOK Memory: %x: %x\n",Common, Msg);
|
RtlCopyMemory(&Msg, pMsg, sizeof(MSG));
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) Msg);
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, (LPARAM) &Msg);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Hit = TRUE;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
if (!Hit && Common->HookId == WH_GETMESSAGE)
|
||||||
|
RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
|
||||||
break;
|
break;
|
||||||
case WH_FOREGROUNDIDLE:
|
case WH_FOREGROUNDIDLE: /* <-- SEH support */
|
||||||
case WH_KEYBOARD:
|
case WH_KEYBOARD:
|
||||||
case WH_SHELL:
|
case WH_SHELL:
|
||||||
Result = Common->Proc(Common->Code, Common->wParam, Common->lParam);
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
Result = Common->Proc(Common->Code, Common->wParam, Common->lParam);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Hit = TRUE;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ZwCallbackReturn(NULL, 0, STATUS_NOT_SUPPORTED);
|
return ZwCallbackReturn(NULL, 0, STATUS_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
if (Hit)
|
||||||
|
{
|
||||||
|
ERR("Hook Exception! Id: %d, Code %d, Proc 0x%x\n",Common->HookId,Common->Code,Common->Proc);
|
||||||
|
}
|
||||||
return ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
return ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ EnableWindow(HWND hWnd,
|
||||||
|
|
||||||
if (Update)
|
if (Update)
|
||||||
{
|
{
|
||||||
|
IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, hWnd, OBJID_WINDOW, CHILDID_SELF, 0);
|
||||||
SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0);
|
SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0);
|
||||||
}
|
}
|
||||||
// Return nonzero if it was disabled, or zero if it wasn't:
|
// Return nonzero if it was disabled, or zero if it wasn't:
|
||||||
|
|
|
@ -1636,6 +1636,8 @@ static BOOL FASTCALL MenuShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, UINT fl
|
||||||
top_popup_hmenu = hmenu;
|
top_popup_hmenu = hmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IntNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPSTART, MenuInfo.Wnd, OBJID_CLIENT, CHILDID_SELF, 0);
|
||||||
|
|
||||||
/* Display the window */
|
/* Display the window */
|
||||||
|
|
||||||
SetWindowPos( MenuInfo.Wnd, HWND_TOPMOST, 0, 0, 0, 0,
|
SetWindowPos( MenuInfo.Wnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||||
|
@ -3445,6 +3447,7 @@ static INT FASTCALL MenuTrackMenu(HMENU hmenu, UINT wFlags, INT x, INT y,
|
||||||
|
|
||||||
if (MenuInfo.Flags & MF_POPUP)
|
if (MenuInfo.Flags & MF_POPUP)
|
||||||
{
|
{
|
||||||
|
IntNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, MenuInfo.Wnd, OBJID_CLIENT, CHILDID_SELF, 0);
|
||||||
DestroyWindow(MenuInfo.Wnd);
|
DestroyWindow(MenuInfo.Wnd);
|
||||||
MenuInfo.Wnd = NULL;
|
MenuInfo.Wnd = NULL;
|
||||||
|
|
||||||
|
@ -3518,7 +3521,11 @@ static BOOL FASTCALL MenuInitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT
|
||||||
MenuInfo.Wnd = hWnd;
|
MenuInfo.Wnd = hWnd;
|
||||||
MenuSetRosMenuInfo(&MenuInfo);
|
MenuSetRosMenuInfo(&MenuInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IntNotifyWinEvent( EVENT_SYSTEM_MENUSTART,
|
||||||
|
hWnd,
|
||||||
|
MenuInfo.Flags & MF_SYSMENU ? OBJID_SYSMENU : OBJID_MENU,
|
||||||
|
CHILDID_SELF, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -3528,6 +3535,7 @@ static BOOL FASTCALL MenuExitTracking(HWND hWnd, BOOL bPopup)
|
||||||
{
|
{
|
||||||
TRACE("hwnd=%p\n", hWnd);
|
TRACE("hwnd=%p\n", hWnd);
|
||||||
|
|
||||||
|
IntNotifyWinEvent( EVENT_SYSTEM_MENUEND, hWnd, OBJID_WINDOW, CHILDID_SELF, 0);
|
||||||
SendMessageW( hWnd, WM_EXITMENULOOP, bPopup, 0 );
|
SendMessageW( hWnd, WM_EXITMENULOOP, bPopup, 0 );
|
||||||
ShowCaret(0);
|
ShowCaret(0);
|
||||||
top_popup = 0;
|
top_popup = 0;
|
||||||
|
@ -3645,7 +3653,7 @@ BOOL WINAPI TrackPopupMenuEx( HMENU Menu, UINT Flags, int x, int y,
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
if (!IsMenu(Menu))
|
if (!IsMenu(Menu))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_INVALID_MENU_HANDLE );
|
SetLastError( ERROR_INVALID_MENU_HANDLE );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -2064,13 +2064,18 @@ SendMessageW(HWND Wnd,
|
||||||
|
|
||||||
if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST))
|
if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST))
|
||||||
{
|
{
|
||||||
if (Window != NULL && Window->head.pti == ti && !IsThreadHooked(GetWin32ClientInfo()))
|
if ( Window != NULL &&
|
||||||
|
Window->head.pti == ti &&
|
||||||
|
!IsThreadHooked(GetWin32ClientInfo()) &&
|
||||||
|
!(Window->state & WNDS_SERVERSIDEWINDOWPROC) )
|
||||||
{
|
{
|
||||||
/* NOTE: We can directly send messages to the window procedure
|
/* NOTE: We can directly send messages to the window procedure
|
||||||
if *all* the following conditions are met:
|
if *all* the following conditions are met:
|
||||||
|
|
||||||
* Window belongs to calling thread
|
* Window belongs to calling thread
|
||||||
* The calling thread is not being hooked
|
* The calling thread is not being hooked
|
||||||
|
* Not calling a server side proc:
|
||||||
|
Desktop, Switch, ScrollBar, Menu, IconTitle, or hWndMessage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, FALSE);
|
return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, FALSE);
|
||||||
|
@ -2130,13 +2135,18 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST))
|
if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST))
|
||||||
{
|
{
|
||||||
if (Window != NULL && Window->head.pti == ti && !IsThreadHooked(GetWin32ClientInfo()))
|
if ( Window != NULL &&
|
||||||
|
Window->head.pti == ti &&
|
||||||
|
!IsThreadHooked(GetWin32ClientInfo()) &&
|
||||||
|
!(Window->state & WNDS_SERVERSIDEWINDOWPROC) )
|
||||||
{
|
{
|
||||||
/* NOTE: We can directly send messages to the window procedure
|
/* NOTE: We can directly send messages to the window procedure
|
||||||
if *all* the following conditions are met:
|
if *all* the following conditions are met:
|
||||||
|
|
||||||
* Window belongs to calling thread
|
* Window belongs to calling thread
|
||||||
* The calling thread is not being hooked
|
* The calling thread is not being hooked
|
||||||
|
* Not calling a server side proc:
|
||||||
|
Desktop, Switch, ScrollBar, Menu, IconTitle, or hWndMessage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, TRUE);
|
return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, TRUE);
|
||||||
|
|
|
@ -2060,7 +2060,11 @@ AnyPopup(VOID)
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
IsWindowInDestroy(HWND hWnd)
|
IsWindowInDestroy(HWND hWnd)
|
||||||
{
|
{
|
||||||
return NtUserIsWindowInDestroy(hWnd);
|
PWND pwnd;
|
||||||
|
pwnd = ValidateHwnd(hWnd);
|
||||||
|
if (!pwnd)
|
||||||
|
return FALSE;
|
||||||
|
return ((pwnd->state2 & WNDS2_INDESTROY) == WNDS2_INDESTROY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -47,6 +47,25 @@ FindPropertyHandler(
|
||||||
IoStatus->Information = PropertySet[Index].PropertyItem[ItemIndex].MinData;
|
IoStatus->Information = PropertySet[Index].PropertyItem[ItemIndex].MinData;
|
||||||
return STATUS_MORE_ENTRIES;
|
return STATUS_MORE_ENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* store property set */
|
||||||
|
*Set = (PKSPROPERTY_SET)&PropertySet[Index];
|
||||||
|
|
||||||
|
if (Property->Flags & KSPROPERTY_TYPE_SET)
|
||||||
|
{
|
||||||
|
/* store property handler */
|
||||||
|
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].SetPropertyHandler;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Property->Flags & KSPROPERTY_TYPE_GET)
|
||||||
|
{
|
||||||
|
/* store property handler */
|
||||||
|
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].GetPropertyHandler;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT)
|
if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT)
|
||||||
{
|
{
|
||||||
PULONG Flags;
|
PULONG Flags;
|
||||||
|
@ -64,14 +83,21 @@ FindPropertyHandler(
|
||||||
/* clear flags */
|
/* clear flags */
|
||||||
*Flags = 0;
|
*Flags = 0;
|
||||||
|
|
||||||
|
IoStatus->Information = sizeof(ULONG);
|
||||||
|
|
||||||
|
if (PropertySet[Index].PropertyItem[ItemIndex].SupportHandler)
|
||||||
|
{
|
||||||
|
/* use support handler from driver */
|
||||||
|
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].SupportHandler;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (PropertySet[Index].PropertyItem[ItemIndex].GetSupported)
|
if (PropertySet[Index].PropertyItem[ItemIndex].GetSupported)
|
||||||
*Flags |= KSPROPERTY_TYPE_GET;
|
*Flags |= KSPROPERTY_TYPE_GET;
|
||||||
|
|
||||||
if (PropertySet[Index].PropertyItem[ItemIndex].SetSupported)
|
if (PropertySet[Index].PropertyItem[ItemIndex].SetSupported)
|
||||||
*Flags |= KSPROPERTY_TYPE_SET;
|
*Flags |= KSPROPERTY_TYPE_SET;
|
||||||
|
|
||||||
IoStatus->Information = sizeof(ULONG);
|
|
||||||
|
|
||||||
if (OutputBufferLength >= sizeof(KSPROPERTY_DESCRIPTION))
|
if (OutputBufferLength >= sizeof(KSPROPERTY_DESCRIPTION))
|
||||||
{
|
{
|
||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
|
@ -89,14 +115,6 @@ FindPropertyHandler(
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
if (Property->Flags & KSPROPERTY_TYPE_SET)
|
|
||||||
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].SetPropertyHandler;
|
|
||||||
|
|
||||||
if (Property->Flags & KSPROPERTY_TYPE_GET)
|
|
||||||
*PropertyHandler = PropertySet[Index].PropertyItem[ItemIndex].GetPropertyHandler;
|
|
||||||
|
|
||||||
*Set = (PKSPROPERTY_SET)&PropertySet[Index];
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +189,7 @@ KspPropertyHandler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsEqualGUIDAligned(&Property->Set, &GUID_NULL) && Property->Id == 0 && Property->Flags == KSPROPERTY_TYPE_SETSUPPORT)
|
else if (IsEqualGUIDAligned(&Property->Set, &GUID_NULL) && Property->Id == 0 && (Property->Flags & KSPROPERTY_TYPE_SETSUPPORT) == KSPROPERTY_TYPE_SETSUPPORT)
|
||||||
{
|
{
|
||||||
// store output size
|
// store output size
|
||||||
Irp->IoStatus.Information = sizeof(GUID) * PropertySetsCount;
|
Irp->IoStatus.Information = sizeof(GUID) * PropertySetsCount;
|
||||||
|
@ -189,7 +207,7 @@ KspPropertyHandler(
|
||||||
{
|
{
|
||||||
RtlMoveMemory(&Guid[Index], PropertySet[Index].Set, sizeof(GUID));
|
RtlMoveMemory(&Guid[Index], PropertySet[Index].Set, sizeof(GUID));
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
|
|
@ -327,7 +327,7 @@ CPortFilterWaveCyclic::Init(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CPortFilterWaveCyclic::FreePin(
|
CPortFilterWaveCyclic::FreePin(
|
||||||
IN struct IPortPinWaveCyclic* Pin)
|
IN PPORTPINWAVECYCLIC Pin)
|
||||||
{
|
{
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
|
|
|
@ -96,13 +96,14 @@ CPortFilterWavePci::NewIrpTarget(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Pins[ConnectDetails->PinId] && m_Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount)
|
if (m_Pins[ConnectDetails->PinId] &&
|
||||||
|
(m_Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount == m_Descriptor->Factory.Instances[ConnectDetails->PinId].MaxFilterInstanceCount))
|
||||||
{
|
{
|
||||||
// release existing instance
|
// no available instance
|
||||||
PC_ASSERT(0);
|
return STATUS_UNSUCCESSFUL;
|
||||||
m_Pins[ConnectDetails->PinId]->Close(DeviceObject, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// now create the pin
|
// now create the pin
|
||||||
Status = NewPortPinWavePci(&Pin);
|
Status = NewPortPinWavePci(&Pin);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -305,6 +306,26 @@ CPortFilterWavePci::Init(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
CPortFilterWavePci::FreePin(
|
||||||
|
IN struct IPortPinWavePci* Pin)
|
||||||
|
{
|
||||||
|
ULONG Index;
|
||||||
|
|
||||||
|
for(Index = 0; Index < m_Descriptor->Factory.PinDescriptorCount; Index++)
|
||||||
|
{
|
||||||
|
if (m_Pins[Index] == Pin)
|
||||||
|
{
|
||||||
|
m_Descriptor->Factory.Instances[Index].CurrentPinInstanceCount--;
|
||||||
|
m_Pins[Index] = NULL;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NewPortFilterWavePci(
|
NewPortFilterWavePci(
|
||||||
OUT IPortFilterWavePci ** OutFilter)
|
OUT IPortFilterWavePci ** OutFilter)
|
||||||
|
|
|
@ -79,6 +79,7 @@ const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {
|
||||||
const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
|
const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
|
||||||
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||||
const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||||
|
const GUID KSPROPSETID_DrmAudioStream = {0x2f2c8ddd, 0x4198, 0x4fac, {0xba, 0x29, 0x61, 0xbb, 0x05, 0xb7, 0xde, 0x06}};
|
||||||
|
|
||||||
const GUID KSEVENTSETID_LoopedStreaming = {0x4682B940L, 0xC6EF, 0x11D0, {0x96, 0xD8, 0x00, 0xAA, 0x00, 0x51, 0xE5, 0x1D}};
|
const GUID KSEVENTSETID_LoopedStreaming = {0x4682B940L, 0xC6EF, 0x11D0, {0x96, 0xD8, 0x00, 0xAA, 0x00, 0x51, 0xE5, 0x1D}};
|
||||||
const GUID KSEVENTSETID_Connection = {0x7f4bcbe0L, 0x9ea5, 0x11cf, {0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00}};
|
const GUID KSEVENTSETID_Connection = {0x7f4bcbe0L, 0x9ea5, 0x11cf, {0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00}};
|
||||||
|
|
|
@ -321,8 +321,7 @@ DECLARE_INTERFACE_(IIrpQueue, IUnknown)
|
||||||
STDMETHOD_(NTSTATUS, Init)(THIS_
|
STDMETHOD_(NTSTATUS, Init)(THIS_
|
||||||
IN KSPIN_CONNECT *ConnectDetails,
|
IN KSPIN_CONNECT *ConnectDetails,
|
||||||
IN ULONG FrameSize,
|
IN ULONG FrameSize,
|
||||||
IN ULONG Alignment,
|
IN ULONG Alignment) PURE;
|
||||||
IN PVOID SilenceBuffer) PURE;
|
|
||||||
|
|
||||||
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
|
STDMETHOD_(NTSTATUS, AddMapping)(THIS_
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
|
@ -363,8 +362,7 @@ DECLARE_INTERFACE_(IIrpQueue, IUnknown)
|
||||||
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
||||||
IN KSPIN_CONNECT *ConnectDetails, \
|
IN KSPIN_CONNECT *ConnectDetails, \
|
||||||
IN ULONG FrameSize, \
|
IN ULONG FrameSize, \
|
||||||
IN ULONG Alignment, \
|
IN ULONG Alignment); \
|
||||||
IN PVOID SilenceBuffer); \
|
|
||||||
\
|
\
|
||||||
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
|
STDMETHODIMP_(NTSTATUS) AddMapping(THIS_ \
|
||||||
IN PIRP Irp, \
|
IN PIRP Irp, \
|
||||||
|
@ -599,6 +597,8 @@ DECLARE_INTERFACE_(IIrpStreamVirtual, IIrpStream)
|
||||||
#undef INTERFACE
|
#undef INTERFACE
|
||||||
#define INTERFACE IPortFilterWavePci
|
#define INTERFACE IPortFilterWavePci
|
||||||
|
|
||||||
|
struct IPortPinWavePci;
|
||||||
|
|
||||||
DECLARE_INTERFACE_(IPortFilterWavePci, IIrpTarget)
|
DECLARE_INTERFACE_(IPortFilterWavePci, IIrpTarget)
|
||||||
{
|
{
|
||||||
DEFINE_ABSTRACT_UNKNOWN()
|
DEFINE_ABSTRACT_UNKNOWN()
|
||||||
|
@ -607,6 +607,9 @@ DECLARE_INTERFACE_(IPortFilterWavePci, IIrpTarget)
|
||||||
|
|
||||||
STDMETHOD_(NTSTATUS, Init)(THIS_
|
STDMETHOD_(NTSTATUS, Init)(THIS_
|
||||||
IN PPORTWAVEPCI Port)PURE;
|
IN PPORTWAVEPCI Port)PURE;
|
||||||
|
|
||||||
|
STDMETHOD_(NTSTATUS, FreePin)(THIS_
|
||||||
|
IN struct IPortPinWavePci* Pin)PURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef IPortFilterWavePci *PPORTFILTERWAVEPCI;
|
typedef IPortFilterWavePci *PPORTFILTERWAVEPCI;
|
||||||
|
@ -614,7 +617,10 @@ typedef IPortFilterWavePci *PPORTFILTERWAVEPCI;
|
||||||
#define IMP_IPortFilterPci \
|
#define IMP_IPortFilterPci \
|
||||||
IMP_IIrpTarget; \
|
IMP_IIrpTarget; \
|
||||||
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
STDMETHODIMP_(NTSTATUS) Init(THIS_ \
|
||||||
IN PPORTWAVEPCI Port)
|
IN PPORTWAVEPCI Port); \
|
||||||
|
STDMETHODIMP_(NTSTATUS) FreePin(THIS_ \
|
||||||
|
IN struct IPortPinWavePci* Pin)
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IPortPinWavePci
|
* IPortPinWavePci
|
||||||
|
|
|
@ -43,7 +43,6 @@ protected:
|
||||||
LIST_ENTRY m_IrpList;
|
LIST_ENTRY m_IrpList;
|
||||||
LIST_ENTRY m_FreeIrpList;
|
LIST_ENTRY m_FreeIrpList;
|
||||||
PIRP m_Irp;
|
PIRP m_Irp;
|
||||||
PVOID m_SilenceBuffer;
|
|
||||||
|
|
||||||
ULONG m_OutOfMapping;
|
ULONG m_OutOfMapping;
|
||||||
ULONG m_MaxFrameSize;
|
ULONG m_MaxFrameSize;
|
||||||
|
@ -84,12 +83,10 @@ NTAPI
|
||||||
CIrpQueue::Init(
|
CIrpQueue::Init(
|
||||||
IN KSPIN_CONNECT *ConnectDetails,
|
IN KSPIN_CONNECT *ConnectDetails,
|
||||||
IN ULONG FrameSize,
|
IN ULONG FrameSize,
|
||||||
IN ULONG Alignment,
|
IN ULONG Alignment)
|
||||||
IN PVOID SilenceBuffer)
|
|
||||||
{
|
{
|
||||||
m_ConnectDetails = ConnectDetails;
|
m_ConnectDetails = ConnectDetails;
|
||||||
m_MaxFrameSize = FrameSize;
|
m_MaxFrameSize = FrameSize;
|
||||||
m_SilenceBuffer = SilenceBuffer;
|
|
||||||
m_Alignment = Alignment;
|
m_Alignment = Alignment;
|
||||||
|
|
||||||
InitializeListHead(&m_IrpList);
|
InitializeListHead(&m_IrpList);
|
||||||
|
@ -259,22 +256,13 @@ CIrpQueue::GetMapping(
|
||||||
m_CurrentOffset = Offset = 0;
|
m_CurrentOffset = Offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Irp && m_SilenceBuffer && m_MaxFrameSize)
|
|
||||||
{
|
|
||||||
DPRINT("NoIrp\n");
|
|
||||||
// no irp available, use silence buffer
|
|
||||||
*Buffer = (PUCHAR)m_SilenceBuffer;
|
|
||||||
*BufferSize = m_MaxFrameSize;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Irp)
|
if (!Irp)
|
||||||
{
|
{
|
||||||
// no irp buffer available
|
// no irp buffer available
|
||||||
|
DPRINT("NoIrp\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get stream header
|
// get stream header
|
||||||
StreamHeader = (PKSSTREAM_HEADER)Irp->Tail.Overlay.DriverContext[2];
|
StreamHeader = (PKSSTREAM_HEADER)Irp->Tail.Overlay.DriverContext[2];
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ CPortPinDMus::Init(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
|
Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
ULONG m_StopCount;
|
ULONG m_StopCount;
|
||||||
KSAUDIO_POSITION m_Position;
|
KSAUDIO_POSITION m_Position;
|
||||||
KSALLOCATOR_FRAMING m_AllocatorFraming;
|
KSALLOCATOR_FRAMING m_AllocatorFraming;
|
||||||
SUBDEVICE_DESCRIPTOR m_Descriptor;
|
PSUBDEVICE_DESCRIPTOR m_Descriptor;
|
||||||
|
|
||||||
KSPIN_LOCK m_EventListLock;
|
KSPIN_LOCK m_EventListLock;
|
||||||
LIST_ENTRY m_EventList;
|
LIST_ENTRY m_EventList;
|
||||||
|
@ -105,10 +105,12 @@ NTSTATUS NTAPI PinWaveCyclicAudioPosition(IN PIRP Irp, IN PKSIDENTIFIER Request,
|
||||||
NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data);
|
NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data);
|
||||||
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
||||||
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry);
|
||||||
|
NTSTATUS NTAPI PinWaveCyclicDRMHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data);
|
||||||
|
|
||||||
|
|
||||||
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState, PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
|
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState, PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
|
||||||
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
|
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
|
||||||
|
DEFINE_KSPROPERTY_DRMSET(PinWaveCyclicDRMSet, PinWaveCyclicDRMHandler);
|
||||||
|
|
||||||
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
|
KSEVENT_ITEM PinWaveCyclicConnectionEventSet =
|
||||||
{
|
{
|
||||||
|
@ -146,6 +148,13 @@ KSPROPERTY_SET PinWaveCyclicPropertySet[] =
|
||||||
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
|
(const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
&KSPROPSETID_DrmAudioStream,
|
||||||
|
sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
|
||||||
|
(const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
|
||||||
|
0,
|
||||||
|
NULL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,6 +201,19 @@ CPortPinWaveCyclic::QueryInterface(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PinWaveCyclicDRMHandler(
|
||||||
|
IN PIRP Irp,
|
||||||
|
IN PKSIDENTIFIER Request,
|
||||||
|
IN OUT PVOID Data)
|
||||||
|
{
|
||||||
|
DPRINT1("PinWaveCyclicDRMHandler\n");
|
||||||
|
ASSERT(0);
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PinWaveCyclicAddEndOfStreamEvent(
|
PinWaveCyclicAddEndOfStreamEvent(
|
||||||
|
@ -448,12 +470,14 @@ PinWaveCyclicState(
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
// complete with successful state
|
// complete with successful state
|
||||||
|
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||||
Pin->m_IrpQueue->CancelBuffers();
|
Pin->m_IrpQueue->CancelBuffers();
|
||||||
Pin->m_Position.PlayOffset = 0;
|
Pin->m_Position.PlayOffset = 0;
|
||||||
Pin->m_Position.WriteOffset = 0;
|
Pin->m_Position.WriteOffset = 0;
|
||||||
}
|
}
|
||||||
else if (Pin->m_State == KSSTATE_STOP)
|
else if (Pin->m_State == KSSTATE_STOP)
|
||||||
{
|
{
|
||||||
|
Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
|
||||||
Pin->m_IrpQueue->CancelBuffers();
|
Pin->m_IrpQueue->CancelBuffers();
|
||||||
Pin->m_Position.PlayOffset = 0;
|
Pin->m_Position.PlayOffset = 0;
|
||||||
Pin->m_Position.WriteOffset = 0;
|
Pin->m_Position.WriteOffset = 0;
|
||||||
|
@ -662,6 +686,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
ULONG BufferLength;
|
ULONG BufferLength;
|
||||||
ULONG BytesToCopy;
|
ULONG BytesToCopy;
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
|
ULONG Gap;
|
||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -672,7 +697,18 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return;
|
{
|
||||||
|
Gap = Position - m_CommonBufferOffset;
|
||||||
|
if (Gap > m_FrameSize)
|
||||||
|
{
|
||||||
|
// insert silence samples
|
||||||
|
DPRINT1("Inserting Silence Buffer Offset %lu GapLength %lu\n", m_CommonBufferOffset, BufferLength);
|
||||||
|
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset, BufferLength);
|
||||||
|
|
||||||
|
m_CommonBufferOffset += BufferLength;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BytesToCopy = min(BufferLength, BufferSize);
|
BytesToCopy = min(BufferLength, BufferSize);
|
||||||
|
|
||||||
|
@ -688,7 +724,7 @@ CPortPinWaveCyclic::UpdateCommonBuffer(
|
||||||
m_IrpQueue->UpdateMapping(BytesToCopy);
|
m_IrpQueue->UpdateMapping(BytesToCopy);
|
||||||
m_CommonBufferOffset += BytesToCopy;
|
m_CommonBufferOffset += BytesToCopy;
|
||||||
|
|
||||||
BufferLength = Position - m_CommonBufferOffset;
|
BufferLength -= BytesToCopy;
|
||||||
m_Position.PlayOffset += BytesToCopy;
|
m_Position.PlayOffset += BytesToCopy;
|
||||||
|
|
||||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||||
|
@ -720,7 +756,18 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return;
|
{
|
||||||
|
Gap = m_CommonBufferSize - m_CommonBufferOffset + Position;
|
||||||
|
if (Gap > m_FrameSize)
|
||||||
|
{
|
||||||
|
// insert silence samples
|
||||||
|
DPRINT1("Overlap Inserting Silence Buffer Size %lu Offset %lu Gap %lu Position %lu\n", m_CommonBufferSize, m_CommonBufferOffset, Gap, Position);
|
||||||
|
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset, BufferLength);
|
||||||
|
|
||||||
|
m_CommonBufferOffset += BufferLength;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
BytesToCopy = min(BufferLength, BufferSize);
|
BytesToCopy = min(BufferLength, BufferSize);
|
||||||
|
|
||||||
|
@ -741,7 +788,7 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
m_CommonBufferOffset += BytesToCopy;
|
m_CommonBufferOffset += BytesToCopy;
|
||||||
m_Position.PlayOffset += BytesToCopy;
|
m_Position.PlayOffset += BytesToCopy;
|
||||||
|
|
||||||
BufferLength = m_CommonBufferSize - m_CommonBufferOffset;
|
BufferLength -=BytesToCopy;
|
||||||
|
|
||||||
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
if (m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
|
||||||
{
|
{
|
||||||
|
@ -751,7 +798,6 @@ CPortPinWaveCyclic::UpdateCommonBufferOverlap(
|
||||||
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
|
m_Position.PlayOffset = m_Position.PlayOffset % m_Position.WriteOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gap == Length)
|
if (Gap == Length)
|
||||||
|
@ -773,22 +819,13 @@ CPortPinWaveCyclic::RequestService()
|
||||||
{
|
{
|
||||||
ULONG Position;
|
ULONG Position;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PUCHAR Buffer;
|
|
||||||
ULONG BufferSize;
|
|
||||||
ULONGLONG OldOffset, NewOffset;
|
ULONGLONG OldOffset, NewOffset;
|
||||||
|
|
||||||
PC_ASSERT_IRQL(DISPATCH_LEVEL);
|
PC_ASSERT_IRQL(DISPATCH_LEVEL);
|
||||||
|
|
||||||
if (m_State == KSSTATE_RUN)
|
if (m_State == KSSTATE_RUN)
|
||||||
{
|
{
|
||||||
Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = m_Stream->GetPosition(&Position);
|
Status = m_Stream->GetPosition(&Position);
|
||||||
DPRINT("Position %u Buffer %p BufferSize %u ActiveIrpOffset %u Capture %u\n", Position, Buffer, m_CommonBufferSize, BufferSize, m_Capture);
|
|
||||||
|
|
||||||
OldOffset = m_Position.PlayOffset;
|
OldOffset = m_Position.PlayOffset;
|
||||||
|
|
||||||
|
@ -841,7 +878,7 @@ CPortPinWaveCyclic::DeviceIoControl(
|
||||||
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
|
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
|
||||||
{
|
{
|
||||||
/* handle property with subdevice descriptor */
|
/* handle property with subdevice descriptor */
|
||||||
Status = PcHandlePropertyWithTable(Irp, m_Descriptor.FilterPropertySetCount, m_Descriptor.FilterPropertySet, &m_Descriptor);
|
Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor);
|
||||||
|
|
||||||
if (Status == STATUS_NOT_FOUND)
|
if (Status == STATUS_NOT_FOUND)
|
||||||
{
|
{
|
||||||
|
@ -854,11 +891,11 @@ CPortPinWaveCyclic::DeviceIoControl(
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
|
||||||
{
|
{
|
||||||
Status = PcHandleEnableEventWithTable(Irp, &m_Descriptor);
|
Status = PcHandleEnableEventWithTable(Irp, m_Descriptor);
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT)
|
||||||
{
|
{
|
||||||
Status = PcHandleDisableEventWithTable(Irp, &m_Descriptor);
|
Status = PcHandleDisableEventWithTable(Irp, m_Descriptor);
|
||||||
}
|
}
|
||||||
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
|
else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
|
||||||
{
|
{
|
||||||
|
@ -960,27 +997,29 @@ CPortPinWaveCyclic::Close(
|
||||||
{
|
{
|
||||||
// free format
|
// free format
|
||||||
FreeItem(m_Format, TAG_PORTCLASS);
|
FreeItem(m_Format, TAG_PORTCLASS);
|
||||||
|
|
||||||
|
// format is freed
|
||||||
m_Format = NULL;
|
m_Format = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_IrpQueue)
|
if (m_IrpQueue)
|
||||||
{
|
{
|
||||||
// fixme cancel irps
|
// cancel remaining irps
|
||||||
|
m_IrpQueue->CancelBuffers();
|
||||||
|
|
||||||
|
// release irp queue
|
||||||
m_IrpQueue->Release();
|
m_IrpQueue->Release();
|
||||||
}
|
|
||||||
|
|
||||||
|
// queue is freed
|
||||||
if (m_Port)
|
m_IrpQueue = NULL;
|
||||||
{
|
|
||||||
// release reference to port driver
|
|
||||||
m_Port->Release();
|
|
||||||
m_Port = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ServiceGroup)
|
if (m_ServiceGroup)
|
||||||
{
|
{
|
||||||
// remove member from service group
|
// remove member from service group
|
||||||
m_ServiceGroup->RemoveMember(PSERVICESINK(this));
|
m_ServiceGroup->RemoveMember(PSERVICESINK(this));
|
||||||
|
|
||||||
|
// do not release service group, it is released by the miniport object
|
||||||
m_ServiceGroup = NULL;
|
m_ServiceGroup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,22 +1038,37 @@ CPortPinWaveCyclic::Close(
|
||||||
// set state to stop
|
// set state to stop
|
||||||
m_State = KSSTATE_STOP;
|
m_State = KSSTATE_STOP;
|
||||||
|
|
||||||
|
|
||||||
DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
|
DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
|
||||||
|
|
||||||
// release stream
|
// release stream
|
||||||
m_Stream->Release();
|
m_Stream->Release();
|
||||||
|
|
||||||
|
// stream is now freed
|
||||||
|
m_Stream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_Filter)
|
if (m_Filter)
|
||||||
{
|
{
|
||||||
// release reference to filter instance
|
// disconnect pin from filter
|
||||||
m_Filter->FreePin((PPORTPINWAVECYCLIC)this);
|
m_Filter->FreePin((PPORTPINWAVECYCLIC)this);
|
||||||
|
|
||||||
|
// release filter reference
|
||||||
m_Filter->Release();
|
m_Filter->Release();
|
||||||
|
|
||||||
|
// pin is done with filter
|
||||||
m_Filter = NULL;
|
m_Filter = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_Port)
|
||||||
|
{
|
||||||
|
// release reference to port driver
|
||||||
|
m_Port->Release();
|
||||||
|
|
||||||
|
// work is done for port
|
||||||
|
m_Port = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
@ -1103,7 +1157,6 @@ CPortPinWaveCyclic::Init(
|
||||||
PKSDATAFORMAT DataFormat;
|
PKSDATAFORMAT DataFormat;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
BOOLEAN Capture;
|
BOOLEAN Capture;
|
||||||
PVOID SilenceBuffer;
|
|
||||||
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
||||||
//IDrmAudioStream * DrmAudio = NULL;
|
//IDrmAudioStream * DrmAudio = NULL;
|
||||||
|
|
||||||
|
@ -1162,7 +1215,6 @@ CPortPinWaveCyclic::Init(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
|
DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
|
||||||
DPRINT1("Bits %u Samples %u Channels %u Tag %u FrameSize %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wBitsPerSample, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nSamplesPerSec, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nChannels, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wFormatTag, m_FrameSize);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1186,18 +1238,26 @@ CPortPinWaveCyclic::Init(
|
||||||
InitializeListHead(&m_EventList);
|
InitializeListHead(&m_EventList);
|
||||||
KeInitializeSpinLock(&m_EventListLock);
|
KeInitializeSpinLock(&m_EventListLock);
|
||||||
|
|
||||||
/* set up subdevice descriptor */
|
Status = PcCreateSubdeviceDescriptor(&m_Descriptor,
|
||||||
RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
|
SubDeviceDescriptor->InterfaceCount,
|
||||||
m_Descriptor.FilterPropertySet = PinWaveCyclicPropertySet;
|
SubDeviceDescriptor->Interfaces,
|
||||||
m_Descriptor.FilterPropertySetCount = sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET);
|
0, /* FIXME KSINTERFACE_STANDARD with KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
|
||||||
m_Descriptor.UnknownStream = (PUNKNOWN)m_Stream;
|
NULL,
|
||||||
m_Descriptor.DeviceDescriptor = SubDeviceDescriptor->DeviceDescriptor;
|
sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET),
|
||||||
m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
PinWaveCyclicPropertySet,
|
||||||
m_Descriptor.PortPin = (PVOID)this;
|
0,
|
||||||
m_Descriptor.EventSetCount = sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET);
|
0,
|
||||||
m_Descriptor.EventSet = PinWaveCyclicEventSet;
|
0,
|
||||||
m_Descriptor.EventList = &m_EventList;
|
NULL,
|
||||||
m_Descriptor.EventListLock = &m_EventListLock;
|
sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET),
|
||||||
|
PinWaveCyclicEventSet,
|
||||||
|
SubDeviceDescriptor->DeviceDescriptor);
|
||||||
|
|
||||||
|
m_Descriptor->UnknownStream = (PUNKNOWN)m_Stream;
|
||||||
|
m_Descriptor->UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
||||||
|
m_Descriptor->PortPin = (PVOID)this;
|
||||||
|
m_Descriptor->EventList = &m_EventList;
|
||||||
|
m_Descriptor->EventListLock = &m_EventListLock;
|
||||||
|
|
||||||
// initialize reset state
|
// initialize reset state
|
||||||
m_ResetState = KSRESET_END;
|
m_ResetState = KSRESET_END;
|
||||||
|
@ -1230,9 +1290,7 @@ CPortPinWaveCyclic::Init(
|
||||||
PC_ASSERT(NT_SUCCESS(Status));
|
PC_ASSERT(NT_SUCCESS(Status));
|
||||||
PC_ASSERT(m_FrameSize);
|
PC_ASSERT(m_FrameSize);
|
||||||
|
|
||||||
SilenceBuffer = AllocateItem(NonPagedPool, m_FrameSize, TAG_PORTCLASS);
|
DPRINT1("Bits %u Samples %u Channels %u Tag %u FrameSize %u CommonBufferSize %lu\n", ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wBitsPerSample, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nSamplesPerSec, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nChannels, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wFormatTag, m_FrameSize, m_CommonBufferSize);
|
||||||
if (!SilenceBuffer)
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
|
|
||||||
/* set up allocator framing */
|
/* set up allocator framing */
|
||||||
|
@ -1243,10 +1301,9 @@ CPortPinWaveCyclic::Init(
|
||||||
m_AllocatorFraming.Reserved = 0;
|
m_AllocatorFraming.Reserved = 0;
|
||||||
m_AllocatorFraming.FrameSize = m_FrameSize;
|
m_AllocatorFraming.FrameSize = m_FrameSize;
|
||||||
|
|
||||||
m_Stream->Silence(SilenceBuffer, m_FrameSize);
|
|
||||||
m_Stream->Silence(m_CommonBuffer, m_CommonBufferSize);
|
m_Stream->Silence(m_CommonBuffer, m_CommonBufferSize);
|
||||||
|
|
||||||
Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0, SilenceBuffer);
|
Status = m_IrpQueue->Init(ConnectDetails, m_FrameSize, 0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
m_IrpQueue->Release();
|
m_IrpQueue->Release();
|
||||||
|
@ -1265,9 +1322,6 @@ CPortPinWaveCyclic::Init(
|
||||||
m_Port = Port;
|
m_Port = Port;
|
||||||
m_Filter = Filter;
|
m_Filter = Filter;
|
||||||
|
|
||||||
//DPRINT("Setting state to acquire %x\n", m_Stream->SetState(KSSTATE_ACQUIRE));
|
|
||||||
//DPRINT("Setting state to pause %x\n", m_Stream->SetState(KSSTATE_PAUSE));
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ protected:
|
||||||
KSAUDIO_POSITION m_Position;
|
KSAUDIO_POSITION m_Position;
|
||||||
ULONG m_StopCount;
|
ULONG m_StopCount;
|
||||||
|
|
||||||
ULONG m_Delay;
|
|
||||||
|
|
||||||
BOOL m_bUsePrefetch;
|
BOOL m_bUsePrefetch;
|
||||||
ULONG m_PrefetchOffset;
|
ULONG m_PrefetchOffset;
|
||||||
SUBDEVICE_DESCRIPTOR m_Descriptor;
|
SUBDEVICE_DESCRIPTOR m_Descriptor;
|
||||||
|
@ -637,41 +635,85 @@ CPortPinWavePci::Close(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
ISubdevice *SubDevice;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PSUBDEVICE_DESCRIPTOR Descriptor;
|
|
||||||
|
if (m_Format)
|
||||||
|
{
|
||||||
|
// free format
|
||||||
|
FreeItem(m_Format, TAG_PORTCLASS);
|
||||||
|
|
||||||
|
// format is freed
|
||||||
|
m_Format = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_IrpQueue)
|
||||||
|
{
|
||||||
|
// cancel remaining irps
|
||||||
|
m_IrpQueue->CancelBuffers();
|
||||||
|
|
||||||
|
// release irp queue
|
||||||
|
m_IrpQueue->Release();
|
||||||
|
|
||||||
|
// queue is freed
|
||||||
|
m_IrpQueue = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_ServiceGroup)
|
if (m_ServiceGroup)
|
||||||
{
|
{
|
||||||
|
// remove member from service group
|
||||||
m_ServiceGroup->RemoveMember(PSERVICESINK(this));
|
m_ServiceGroup->RemoveMember(PSERVICESINK(this));
|
||||||
|
|
||||||
|
// do not release service group, it is released by the miniport object
|
||||||
|
m_ServiceGroup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Stream)
|
if (m_Stream)
|
||||||
{
|
{
|
||||||
if (m_State != KSSTATE_STOP)
|
if (m_State != KSSTATE_STOP)
|
||||||
{
|
{
|
||||||
m_Stream->SetState(KSSTATE_STOP);
|
// stop stream
|
||||||
|
Status = m_Stream->SetState(KSSTATE_STOP);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("Warning: failed to stop stream with %x\n", Status);
|
||||||
|
PC_ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// set state to stop
|
||||||
|
m_State = KSSTATE_STOP;
|
||||||
|
|
||||||
|
DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
|
||||||
|
|
||||||
|
// release stream
|
||||||
m_Stream->Release();
|
m_Stream->Release();
|
||||||
|
|
||||||
|
// stream is now freed
|
||||||
|
m_Stream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&SubDevice);
|
if (m_Filter)
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
Status = SubDevice->GetDescriptor(&Descriptor);
|
// disconnect pin from filter
|
||||||
if (NT_SUCCESS(Status))
|
m_Filter->FreePin((PPORTPINWAVEPCI)this);
|
||||||
{
|
|
||||||
Descriptor->Factory.Instances[m_ConnectDetails->PinId].CurrentPinInstanceCount--;
|
// release filter reference
|
||||||
}
|
m_Filter->Release();
|
||||||
SubDevice->Release();
|
|
||||||
|
// pin is done with filter
|
||||||
|
m_Filter = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Format)
|
if (m_Port)
|
||||||
{
|
{
|
||||||
FreeItem(m_Format, TAG_PORTCLASS);
|
// release reference to port driver
|
||||||
m_Format = NULL;
|
m_Port->Release();
|
||||||
|
|
||||||
|
// work is done for port
|
||||||
|
m_Port = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// successfully complete irp
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
@ -756,33 +798,18 @@ CPortPinWavePci::Init(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKSDATAFORMAT DataFormat;
|
PKSDATAFORMAT DataFormat;
|
||||||
BOOLEAN Capture;
|
BOOLEAN Capture;
|
||||||
|
ISubdevice * Subdevice = NULL;
|
||||||
|
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
||||||
|
|
||||||
Port->AddRef();
|
// check if it is a source / sink pin
|
||||||
Filter->AddRef();
|
|
||||||
|
|
||||||
m_Port = Port;
|
|
||||||
m_Filter = Filter;
|
|
||||||
m_KsPinDescriptor = KsPinDescriptor;
|
|
||||||
m_ConnectDetails = ConnectDetails;
|
|
||||||
m_Miniport = GetWavePciMiniport(Port);
|
|
||||||
m_DeviceObject = DeviceObject;
|
|
||||||
|
|
||||||
DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1);
|
|
||||||
|
|
||||||
DPRINT("IPortPinWavePci_fnInit entered\n");
|
|
||||||
|
|
||||||
m_Format = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
|
|
||||||
if (!m_Format)
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
RtlMoveMemory(m_Format, DataFormat, DataFormat->FormatSize);
|
|
||||||
|
|
||||||
if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN)
|
if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN)
|
||||||
{
|
{
|
||||||
|
// sink pin
|
||||||
Capture = FALSE;
|
Capture = FALSE;
|
||||||
}
|
}
|
||||||
else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT)
|
else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT)
|
||||||
{
|
{
|
||||||
|
// source pin
|
||||||
Capture = TRUE;
|
Capture = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -792,6 +819,45 @@ CPortPinWavePci::Init(
|
||||||
while(TRUE);
|
while(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add port / filter reference
|
||||||
|
Port->AddRef();
|
||||||
|
Filter->AddRef();
|
||||||
|
|
||||||
|
// initialize pin
|
||||||
|
m_Port = Port;
|
||||||
|
m_Filter = Filter;
|
||||||
|
m_KsPinDescriptor = KsPinDescriptor;
|
||||||
|
m_ConnectDetails = ConnectDetails;
|
||||||
|
m_Miniport = GetWavePciMiniport(Port);
|
||||||
|
m_DeviceObject = DeviceObject;
|
||||||
|
m_State = KSSTATE_STOP;
|
||||||
|
m_Capture = Capture;
|
||||||
|
|
||||||
|
DPRINT("IPortPinWavePci_fnInit entered\n");
|
||||||
|
|
||||||
|
// get dataformat
|
||||||
|
DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1);
|
||||||
|
|
||||||
|
// allocate data format
|
||||||
|
m_Format = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
|
||||||
|
if (!m_Format)
|
||||||
|
{
|
||||||
|
// release references
|
||||||
|
m_Port->Release();
|
||||||
|
m_Filter->Release();
|
||||||
|
|
||||||
|
// no dangling pointers
|
||||||
|
Port = NULL;
|
||||||
|
Filter = NULL;
|
||||||
|
|
||||||
|
// failed to allocate data format
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy data format
|
||||||
|
RtlMoveMemory(m_Format, DataFormat, DataFormat->FormatSize);
|
||||||
|
|
||||||
|
// allocate new stream
|
||||||
Status = m_Miniport->NewStream(&m_Stream,
|
Status = m_Miniport->NewStream(&m_Stream,
|
||||||
NULL,
|
NULL,
|
||||||
NonPagedPool,
|
NonPagedPool,
|
||||||
|
@ -805,47 +871,81 @@ CPortPinWavePci::Init(
|
||||||
DPRINT("IPortPinWavePci_fnInit Status %x\n", Status);
|
DPRINT("IPortPinWavePci_fnInit Status %x\n", Status);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
|
||||||
|
|
||||||
if (m_ServiceGroup)
|
|
||||||
{
|
{
|
||||||
Status = m_ServiceGroup->AddMember(PSERVICESINK(this));
|
// free references
|
||||||
if (!NT_SUCCESS(Status))
|
Port->Release();
|
||||||
{
|
Filter->Release();
|
||||||
DPRINT("Failed to add pin to service group\n");
|
|
||||||
return Status;
|
// free data format
|
||||||
}
|
FreeItem(m_Format, TAG_PORTCLASS);
|
||||||
|
|
||||||
|
// no dangling pointers
|
||||||
|
m_Port = NULL;
|
||||||
|
m_Filter = NULL;
|
||||||
|
m_Format = NULL;
|
||||||
|
|
||||||
|
// failed to allocate stream
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delay of 10 milisec
|
// get allocator requirements for pin
|
||||||
m_Delay = Int32x32To64(10, -10000);
|
|
||||||
|
|
||||||
Status = m_Stream->GetAllocatorFraming(&m_AllocatorFraming);
|
Status = m_Stream->GetAllocatorFraming(&m_AllocatorFraming);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT("OptionFlags %x RequirementsFlag %x PoolType %x Frames %lu FrameSize %lu FileAlignment %lu\n",
|
||||||
|
m_AllocatorFraming.OptionsFlags, m_AllocatorFraming.RequirementsFlags, m_AllocatorFraming.PoolType, m_AllocatorFraming.Frames, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocate new irp queue
|
||||||
|
Status = NewIrpQueue(&m_IrpQueue);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("GetAllocatorFraming failed with %x\n", Status);
|
// free references
|
||||||
|
Port->Release();
|
||||||
|
Filter->Release();
|
||||||
|
m_Stream->Release();
|
||||||
|
|
||||||
|
// free data format
|
||||||
|
FreeItem(m_Format, TAG_PORTCLASS);
|
||||||
|
|
||||||
|
// no dangling pointers
|
||||||
|
m_Port = NULL;
|
||||||
|
m_Filter = NULL;
|
||||||
|
m_Format = NULL;
|
||||||
|
m_Stream = NULL;
|
||||||
|
|
||||||
|
// failed to allocate irp queue
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("OptionFlags %x RequirementsFlag %x PoolType %x Frames %lu FrameSize %lu FileAlignment %lu\n",
|
// initialize irp queue
|
||||||
m_AllocatorFraming.OptionsFlags, m_AllocatorFraming.RequirementsFlags, m_AllocatorFraming.PoolType, m_AllocatorFraming.Frames, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment);
|
Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
// this should never happen
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
|
||||||
ISubdevice * Subdevice = NULL;
|
|
||||||
// get subdevice interface
|
// get subdevice interface
|
||||||
Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&Subdevice);
|
Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&Subdevice);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
{
|
||||||
|
// this function should never fail
|
||||||
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get subdevice descriptor
|
||||||
Status = Subdevice->GetDescriptor(&SubDeviceDescriptor);
|
Status = Subdevice->GetDescriptor(&SubDeviceDescriptor);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
// failed to get descriptor
|
// this function should never fail
|
||||||
Subdevice->Release();
|
ASSERT(0);
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// release subdevice
|
||||||
|
Subdevice->Release();
|
||||||
|
|
||||||
/* set up subdevice descriptor */
|
/* set up subdevice descriptor */
|
||||||
RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
|
RtlZeroMemory(&m_Descriptor, sizeof(SUBDEVICE_DESCRIPTOR));
|
||||||
m_Descriptor.FilterPropertySet = PinWavePciPropertySet;
|
m_Descriptor.FilterPropertySet = PinWavePciPropertySet;
|
||||||
|
@ -855,21 +955,30 @@ CPortPinWavePci::Init(
|
||||||
m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
m_Descriptor.UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
|
||||||
m_Descriptor.PortPin = (PVOID)this;
|
m_Descriptor.PortPin = (PVOID)this;
|
||||||
|
|
||||||
|
if (m_ServiceGroup)
|
||||||
|
|
||||||
Status = NewIrpQueue(&m_IrpQueue);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return Status;
|
|
||||||
|
|
||||||
Status = m_IrpQueue->Init(ConnectDetails, m_AllocatorFraming.FrameSize, m_AllocatorFraming.FileAlignment, NULL);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
DPRINT("IrpQueue_Init failed with %x\n", Status);
|
Status = m_ServiceGroup->AddMember(PSERVICESINK(this));
|
||||||
return Status;
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
// free references
|
||||||
|
m_Stream->Release();
|
||||||
|
Port->Release();
|
||||||
|
Filter->Release();
|
||||||
|
|
||||||
|
// free data format
|
||||||
|
FreeItem(m_Format, TAG_PORTCLASS);
|
||||||
|
|
||||||
|
// no dangling pointers
|
||||||
|
m_Stream = NULL;
|
||||||
|
m_Port = NULL;
|
||||||
|
m_Filter = NULL;
|
||||||
|
m_Format = NULL;
|
||||||
|
|
||||||
|
// failed to add to service group
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_State = KSSTATE_STOP;
|
|
||||||
m_Capture = Capture;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,7 +587,7 @@ CPortPinWaveRT::Init(
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL);
|
Status = m_IrpQueue->Init(ConnectDetails, 0, 0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
|
@ -275,12 +275,12 @@ CPortWaveCyclic::Init(
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the subdevice descriptor
|
// create the subdevice descriptor
|
||||||
Status = PcCreateSubdeviceDescriptor(&m_SubDeviceDescriptor,
|
Status = PcCreateSubdeviceDescriptor(&m_SubDeviceDescriptor,
|
||||||
4,
|
4,
|
||||||
InterfaceGuids,
|
InterfaceGuids,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
2,
|
2,
|
||||||
WaveCyclicPropertySet,
|
WaveCyclicPropertySet,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -356,6 +356,22 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||||
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
|
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)\
|
||||||
|
DEFINE_KSPROPERTY_ITEM(\
|
||||||
|
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,\
|
||||||
|
NULL,\
|
||||||
|
sizeof(KSPROPERTY),\
|
||||||
|
sizeof(ULONG),\
|
||||||
|
(SetHandler),\
|
||||||
|
NULL, 0, NULL, NULL, 0)
|
||||||
|
|
||||||
|
#define DEFINE_KSPROPERTY_DRMSET(PinSet,\
|
||||||
|
PropPositionHandler)\
|
||||||
|
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||||
|
DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\
|
||||||
|
}
|
||||||
|
|
||||||
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
|
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
|
||||||
PropGeneral, PropInstances, PropIntersection)\
|
PropGeneral, PropInstances, PropIntersection)\
|
||||||
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
DEFINE_KSPROPERTY_TABLE(PinSet) {\
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -235,8 +235,9 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
if (!HalpGetInfoFromACPI)
|
if (!HalpGetInfoFromACPI)
|
||||||
{
|
{
|
||||||
/* No, so use our local table */
|
/* No, so use our local table */
|
||||||
Port = HalpComPortIrqMapping[0][0];
|
for (i = 0, Port = HalpComPortIrqMapping[i][0];
|
||||||
for (i = 0; Port; i++)
|
Port;
|
||||||
|
i++, Port = HalpComPortIrqMapping[i][0])
|
||||||
{
|
{
|
||||||
/* Is this the port we want? */
|
/* Is this the port we want? */
|
||||||
if (Port == (ULONG_PTR)KdComPortInUse)
|
if (Port == (ULONG_PTR)KdComPortInUse)
|
||||||
|
@ -248,9 +249,6 @@ HalpReportResourceUsage(IN PUNICODE_STRING HalName,
|
||||||
PRIMARY_VECTOR_BASE,
|
PRIMARY_VECTOR_BASE,
|
||||||
HIGH_LEVEL);
|
HIGH_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next port */
|
|
||||||
Port = HalpComPortIrqMapping[i][0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,6 +507,9 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
|
||||||
IN PVOID Handler,
|
IN PVOID Handler,
|
||||||
IN KINTERRUPT_MODE Mode)
|
IN KINTERRUPT_MODE Mode)
|
||||||
{
|
{
|
||||||
|
/* Set the IDT_LATCHED flag for latched interrupts */
|
||||||
|
if (Mode == Latched) Flags |= IDT_LATCHED;
|
||||||
|
|
||||||
/* Register the vector */
|
/* Register the vector */
|
||||||
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
|
||||||
|
|
||||||
|
|
|
@ -1005,11 +1005,6 @@ DEFINE_GUIDSTRUCT("97E99BA0-BDEA-11CF-A5D6-28DB04C10000", KSPROPTYPESETID_Genera
|
||||||
KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
|
KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KSPROPSETID_DrmAudioStream
|
|
||||||
/*
|
|
||||||
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define KSPROPSETID_Hrtf3d
|
#define KSPROPSETID_Hrtf3d
|
||||||
/*
|
/*
|
||||||
KSPROPERTY_HRTF3D_FILTER_FORMAT
|
KSPROPERTY_HRTF3D_FILTER_FORMAT
|
||||||
|
|
|
@ -565,6 +565,15 @@ typedef struct {
|
||||||
#endif // !_NTDDK_
|
#endif // !_NTDDK_
|
||||||
} LOOPEDSTREAMING_POSITION_EVENT_DATA, *PLOOPEDSTREAMING_POSITION_EVENT_DATA ;
|
} LOOPEDSTREAMING_POSITION_EVENT_DATA, *PLOOPEDSTREAMING_POSITION_EVENT_DATA ;
|
||||||
|
|
||||||
|
#define STATIC_KSPROPSETID_DrmAudioStream\
|
||||||
|
0x2f2c8ddd, 0x4198, 0x4fac, 0xba, 0x29, 0x61, 0xbb, 0x5, 0xb7, 0xde, 0x6
|
||||||
|
DEFINE_GUIDSTRUCT("2F2C8DDD-4198-4fac-BA29-61BB05B7DE06", KSPROPSETID_DrmAudioStream);
|
||||||
|
#define KSPROPSETID_DrmAudioStream DEFINE_GUIDNAMED(KSPROPSETID_DrmAudioStream)
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
|
||||||
|
} KSPROPERTY_DRMAUDIOSTREAM;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SysAudio Properties
|
SysAudio Properties
|
||||||
|
|
|
@ -51,13 +51,15 @@ VOID NTAPI RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING,IN PCSZ,IN INT);
|
||||||
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING,IN PCWSTR,IN INT);
|
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING,IN PCWSTR,IN INT);
|
||||||
BOOL NTAPI RtlLargeStringToUnicodeString( PUNICODE_STRING, PLARGE_STRING);
|
BOOL NTAPI RtlLargeStringToUnicodeString( PUNICODE_STRING, PLARGE_STRING);
|
||||||
|
|
||||||
|
#define NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
|
||||||
|
|
||||||
typedef struct _DESKTOPINFO
|
typedef struct _DESKTOPINFO
|
||||||
{
|
{
|
||||||
PVOID pvDesktopBase;
|
PVOID pvDesktopBase;
|
||||||
PVOID pvDesktopLimit;
|
PVOID pvDesktopLimit;
|
||||||
struct _WND *spwnd;
|
struct _WND *spwnd;
|
||||||
DWORD fsHooks;
|
DWORD fsHooks;
|
||||||
struct tagHOOK * aphkStart[16];
|
LIST_ENTRY aphkStart[NB_HOOKS];
|
||||||
|
|
||||||
HWND hTaskManWindow;
|
HWND hTaskManWindow;
|
||||||
HWND hProgmanWindow;
|
HWND hProgmanWindow;
|
||||||
|
@ -127,15 +129,23 @@ typedef struct _PROCMARKHEAD
|
||||||
/* Window Client Information structure */
|
/* Window Client Information structure */
|
||||||
struct _ETHREAD;
|
struct _ETHREAD;
|
||||||
|
|
||||||
|
#define WEF_SETBYWNDPTI 0x0001
|
||||||
|
|
||||||
typedef struct tagHOOK
|
typedef struct tagHOOK
|
||||||
{
|
{
|
||||||
THRDESKHEAD head;
|
THRDESKHEAD head;
|
||||||
|
struct tagHOOK *phkNext; /* This is for user space. */
|
||||||
|
int HookId; /* Hook table index */
|
||||||
|
ULONG_PTR offPfn;
|
||||||
|
ULONG flags; /* Some internal flags */
|
||||||
|
INT ihmod;
|
||||||
|
PTHREADINFO ptiHooked;
|
||||||
|
struct _DESKTOP *rpdesk;
|
||||||
|
/* ReactOS */
|
||||||
LIST_ENTRY Chain; /* Hook chain entry */
|
LIST_ENTRY Chain; /* Hook chain entry */
|
||||||
struct _ETHREAD* Thread; /* Thread owning the hook */
|
struct _ETHREAD* Thread; /* Thread owning the hook */
|
||||||
int HookId; /* Hook table index */
|
|
||||||
HOOKPROC Proc; /* Hook function */
|
HOOKPROC Proc; /* Hook function */
|
||||||
BOOLEAN Ansi; /* Is it an Ansi hook? */
|
BOOLEAN Ansi; /* Is it an Ansi hook? */
|
||||||
ULONG Flags; /* Some internal flags */
|
|
||||||
UNICODE_STRING ModuleName; /* Module name for global hooks */
|
UNICODE_STRING ModuleName; /* Module name for global hooks */
|
||||||
} HOOK, *PHOOK;
|
} HOOK, *PHOOK;
|
||||||
|
|
||||||
|
@ -3149,7 +3159,6 @@ typedef struct tagKMDDELPARAM
|
||||||
#define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006
|
#define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006
|
||||||
#define ONEPARAM_ROUTINE_CSRSS_GUICHECK 0xffff0008
|
#define ONEPARAM_ROUTINE_CSRSS_GUICHECK 0xffff0008
|
||||||
#define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0xfffe0008
|
#define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0xfffe0008
|
||||||
#define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0xfffe000c
|
|
||||||
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
|
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
|
||||||
#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0xfffe000e
|
#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0xfffe000e
|
||||||
#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0xfffe0027
|
#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0xfffe0027
|
||||||
|
@ -3167,6 +3176,7 @@ typedef struct tagKMDDELPARAM
|
||||||
#define TWOPARAM_ROUTINE_SETCARETPOS 0xfffd0060
|
#define TWOPARAM_ROUTINE_SETCARETPOS 0xfffd0060
|
||||||
#define TWOPARAM_ROUTINE_REGISTERLOGONPROC 0xfffd0062
|
#define TWOPARAM_ROUTINE_REGISTERLOGONPROC 0xfffd0062
|
||||||
#define TWOPARAM_ROUTINE_ROS_UPDATEUISTATE 0x1004
|
#define TWOPARAM_ROUTINE_ROS_UPDATEUISTATE 0x1004
|
||||||
|
#define HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT 0x1005
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -514,6 +514,21 @@ IopAssignDeviceResources(
|
||||||
IN PDEVICE_NODE DeviceNode
|
IN PDEVICE_NODE DeviceNode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IopCreateResourceListFromRequirements(
|
||||||
|
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
||||||
|
OUT PCM_RESOURCE_LIST *ResourceList
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IopDetectResourceConflict(
|
||||||
|
IN PCM_RESOURCE_LIST ResourceList,
|
||||||
|
IN BOOLEAN Silent,
|
||||||
|
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// PNP Routines
|
// PNP Routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -841,7 +841,7 @@ IoGetConfigurationInformation(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @halfplemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||||
|
@ -876,13 +876,48 @@ IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||||
* a conflict is detected with another driver.
|
* a conflict is detected with another driver.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
*ConflictDetected = FALSE;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
return STATUS_SUCCESS;
|
|
||||||
|
DPRINT1("IoReportResourceUsage is halfplemented!\n");
|
||||||
|
|
||||||
|
if (!DriverList && !DeviceList)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (DeviceList)
|
||||||
|
ResourceList = DeviceList;
|
||||||
|
else
|
||||||
|
ResourceList = DriverList;
|
||||||
|
|
||||||
|
Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
|
||||||
|
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||||
|
{
|
||||||
|
*ConflictDetected = TRUE;
|
||||||
|
|
||||||
|
if (!OverrideConflict)
|
||||||
|
{
|
||||||
|
DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
|
||||||
|
return STATUS_CONFLICTING_ADDRESSES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("Proceeding with conflicting resources\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Claim resources in registry */
|
||||||
|
|
||||||
|
*ConflictDetected = FALSE;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @halfplemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IoAssignResources(PUNICODE_STRING RegistryPath,
|
IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||||
|
@ -892,8 +927,23 @@ IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||||
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
||||||
PCM_RESOURCE_LIST* AllocatedResources)
|
PCM_RESOURCE_LIST* AllocatedResources)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
|
||||||
|
DPRINT1("IoAssignResources is halfplemented!\n");
|
||||||
|
|
||||||
|
Status = IopCreateResourceListFromRequirements(RequestedResources,
|
||||||
|
AllocatedResources);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||||
|
DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Claim resources in registry */
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -38,9 +38,6 @@ NTSTATUS
|
||||||
IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
|
IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
|
||||||
PVOID Context);
|
PVOID Context);
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
IopDetectResourceConflict(IN PCM_RESOURCE_LIST ResourceList);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
PpSetCustomTargetEvent(IN PDEVICE_OBJECT DeviceObject,
|
PpSetCustomTargetEvent(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN OUT PKEVENT SyncEvent OPTIONAL,
|
IN OUT PKEVENT SyncEvent OPTIONAL,
|
||||||
|
@ -379,7 +376,7 @@ IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject,
|
||||||
ResourceList = DriverList;
|
ResourceList = DriverList;
|
||||||
|
|
||||||
/* Look for a resource conflict */
|
/* Look for a resource conflict */
|
||||||
Status = IopDetectResourceConflict(ResourceList);
|
Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
|
||||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||||
{
|
{
|
||||||
/* Oh noes */
|
/* Oh noes */
|
||||||
|
|
|
@ -12,12 +12,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
IopDetectResourceConflict(
|
|
||||||
IN PCM_RESOURCE_LIST ResourceList,
|
|
||||||
IN BOOLEAN Silent,
|
|
||||||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor);
|
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor)
|
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor)
|
||||||
|
@ -187,8 +181,8 @@ IopFindInterruptResource(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
NTSTATUS
|
NTSTATUS NTAPI
|
||||||
IopCreateResourceListFromRequirements(
|
IopCreateResourceListFromRequirements(
|
||||||
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList,
|
||||||
OUT PCM_RESOURCE_LIST *ResourceList)
|
OUT PCM_RESOURCE_LIST *ResourceList)
|
||||||
|
@ -336,9 +330,6 @@ IopCheckResourceDescriptor(
|
||||||
ULONG i, ii;
|
ULONG i, ii;
|
||||||
BOOLEAN Result = FALSE;
|
BOOLEAN Result = FALSE;
|
||||||
|
|
||||||
if (ResDesc->ShareDisposition == CmResourceShareShared)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
for (i = 0; i < ResourceList->Count; i++)
|
for (i = 0; i < ResourceList->Count; i++)
|
||||||
{
|
{
|
||||||
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList;
|
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList;
|
||||||
|
@ -615,40 +606,61 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
||||||
|
|
||||||
if (DeviceNode->ResourceList)
|
if (DeviceNode->ResourceList)
|
||||||
{
|
{
|
||||||
PWCHAR DeviceName = NULL;
|
|
||||||
UNICODE_STRING NameU;
|
UNICODE_STRING NameU;
|
||||||
UNICODE_STRING Suffix;
|
UNICODE_STRING RawSuffix, TranslatedSuffix;
|
||||||
ULONG OldLength = 0;
|
ULONG OldLength = 0;
|
||||||
|
|
||||||
ASSERT(DeviceNode->ResourceListTranslated);
|
ASSERT(DeviceNode->ResourceListTranslated);
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&TranslatedSuffix, L".Translated");
|
||||||
|
RtlInitUnicodeString(&RawSuffix, L".Raw");
|
||||||
|
|
||||||
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||||
DevicePropertyPhysicalDeviceObjectName,
|
DevicePropertyPhysicalDeviceObjectName,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&OldLength);
|
&OldLength);
|
||||||
if ((OldLength != 0) && (Status == STATUS_BUFFER_TOO_SMALL))
|
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
DeviceName = ExAllocatePool(NonPagedPool, OldLength);
|
ASSERT(OldLength);
|
||||||
ASSERT(DeviceName);
|
|
||||||
|
NameU.Buffer = ExAllocatePool(PagedPool, OldLength + TranslatedSuffix.Length);
|
||||||
|
if (!NameU.Buffer)
|
||||||
|
{
|
||||||
|
ZwClose(PnpMgrLevel2);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
NameU.Length = 0;
|
||||||
|
NameU.MaximumLength = OldLength + TranslatedSuffix.Length;
|
||||||
|
|
||||||
|
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
||||||
|
DevicePropertyPhysicalDeviceObjectName,
|
||||||
|
NameU.MaximumLength,
|
||||||
|
NameU.Buffer,
|
||||||
|
&OldLength);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ZwClose(PnpMgrLevel2);
|
||||||
|
ExFreePool(NameU.Buffer);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Some failure */
|
||||||
|
ZwClose(PnpMgrLevel2);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This should never happen */
|
||||||
|
ASSERT(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
NameU.Length = OldLength;
|
||||||
|
|
||||||
IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
|
RtlAppendUnicodeStringToString(&NameU, &RawSuffix);
|
||||||
DevicePropertyPhysicalDeviceObjectName,
|
|
||||||
OldLength,
|
|
||||||
DeviceName,
|
|
||||||
&OldLength);
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&NameU, DeviceName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Some failure */
|
|
||||||
ASSERT(!NT_SUCCESS(Status));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&Suffix, L".Raw");
|
|
||||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
|
||||||
|
|
||||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||||
&NameU,
|
&NameU,
|
||||||
|
@ -659,14 +671,14 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ZwClose(PnpMgrLevel2);
|
ZwClose(PnpMgrLevel2);
|
||||||
|
ExFreePool(NameU.Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Remove" the suffix by setting the length back to what it used to be */
|
/* "Remove" the suffix by setting the length back to what it used to be */
|
||||||
NameU.Length = (USHORT)OldLength;
|
NameU.Length = OldLength;
|
||||||
|
|
||||||
RtlInitUnicodeString(&Suffix, L".Translated");
|
RtlAppendUnicodeStringToString(&NameU, &TranslatedSuffix);
|
||||||
RtlAppendUnicodeStringToString(&NameU, &Suffix);
|
|
||||||
|
|
||||||
Status = ZwSetValueKey(PnpMgrLevel2,
|
Status = ZwSetValueKey(PnpMgrLevel2,
|
||||||
&NameU,
|
&NameU,
|
||||||
|
@ -675,8 +687,8 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2
|
||||||
DeviceNode->ResourceListTranslated,
|
DeviceNode->ResourceListTranslated,
|
||||||
PnpDetermineResourceListSize(DeviceNode->ResourceListTranslated));
|
PnpDetermineResourceListSize(DeviceNode->ResourceListTranslated));
|
||||||
ZwClose(PnpMgrLevel2);
|
ZwClose(PnpMgrLevel2);
|
||||||
ASSERT(DeviceName);
|
ExFreePool(NameU.Buffer);
|
||||||
ExFreePool(DeviceName);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +730,7 @@ IopTranslateDeviceResources(
|
||||||
DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
|
DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
|
||||||
if (!DeviceNode->ResourceListTranslated)
|
if (!DeviceNode->ResourceListTranslated)
|
||||||
{
|
{
|
||||||
Status =STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
|
RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
|
||||||
|
@ -743,6 +755,7 @@ IopTranslateDeviceResources(
|
||||||
&DescriptorTranslated->u.Port.Start))
|
&DescriptorTranslated->u.Port.Start))
|
||||||
{
|
{
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DPRINT1("Failed to translate port resource (Start: 0xI64x)\n", DescriptorRaw->u.Port.Start.QuadPart);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -756,6 +769,14 @@ IopTranslateDeviceResources(
|
||||||
DescriptorRaw->u.Interrupt.Vector,
|
DescriptorRaw->u.Interrupt.Vector,
|
||||||
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
|
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
|
||||||
&DescriptorTranslated->u.Interrupt.Affinity);
|
&DescriptorTranslated->u.Interrupt.Affinity);
|
||||||
|
|
||||||
|
if (!DescriptorTranslated->u.Interrupt.Vector)
|
||||||
|
{
|
||||||
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DPRINT1("Failed to translate interrupt resource (Vector: 0x%x | Level: 0x%x)\n", DescriptorRaw->u.Interrupt.Vector,
|
||||||
|
DescriptorRaw->u.Interrupt.Level);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CmResourceTypeMemory:
|
case CmResourceTypeMemory:
|
||||||
|
@ -769,6 +790,7 @@ IopTranslateDeviceResources(
|
||||||
&DescriptorTranslated->u.Memory.Start))
|
&DescriptorTranslated->u.Memory.Start))
|
||||||
{
|
{
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
|
DPRINT1("Failed to translate memory resource (Start: 0xI64x)\n", DescriptorRaw->u.Memory.Start.QuadPart);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,16 +886,21 @@ IopAssignDeviceResources(
|
||||||
Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
|
Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
|
||||||
&DeviceNode->ResourceList);
|
&DeviceNode->ResourceList);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create a resource list from supplied resources for %wZ\n", &DeviceNode->InstancePath);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL);
|
/* IopCreateResourceListFromRequirements should NEVER succeed with a conflicting list */
|
||||||
if (!NT_SUCCESS(Status))
|
ASSERT(IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL) != STATUS_CONFLICTING_ADDRESSES);
|
||||||
goto ByeBye;
|
|
||||||
|
|
||||||
Finish:
|
Finish:
|
||||||
Status = IopTranslateDeviceResources(DeviceNode);
|
Status = IopTranslateDeviceResources(DeviceNode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to translate resources for %wZ\n", &DeviceNode->InstancePath);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
|
Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -935,7 +962,7 @@ ByeBye:
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS NTAPI
|
||||||
IopDetectResourceConflict(
|
IopDetectResourceConflict(
|
||||||
IN PCM_RESOURCE_LIST ResourceList,
|
IN PCM_RESOURCE_LIST ResourceList,
|
||||||
IN BOOLEAN Silent,
|
IN BOOLEAN Silent,
|
||||||
|
|
|
@ -1048,6 +1048,48 @@ MmFlushVirtualMemory(IN PEPROCESS Process,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
MiGetPageProtection(IN PMMPTE PointerPte)
|
||||||
|
{
|
||||||
|
MMPTE TempPte;
|
||||||
|
PMMPFN Pfn;
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
/* Copy this PTE's contents */
|
||||||
|
TempPte = *PointerPte;
|
||||||
|
|
||||||
|
/* Assure it's not totally zero */
|
||||||
|
ASSERT(TempPte.u.Long);
|
||||||
|
|
||||||
|
/* Check for a special prototype format */
|
||||||
|
if (TempPte.u.Soft.Valid == 0 &&
|
||||||
|
TempPte.u.Soft.Prototype == 1)
|
||||||
|
{
|
||||||
|
/* Unsupported now */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
ASSERT(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* In the easy case of transition or demand zero PTE just return its protection */
|
||||||
|
if (!TempPte.u.Hard.Valid) return MmProtectToValue[TempPte.u.Soft.Protection];
|
||||||
|
|
||||||
|
/* If we get here, the PTE is valid, so look up the page in PFN database */
|
||||||
|
Pfn = MiGetPfnEntry(TempPte.u.Hard.PageFrameNumber);
|
||||||
|
|
||||||
|
if (!Pfn->u3.e1.PrototypePte)
|
||||||
|
{
|
||||||
|
/* Return protection of the original pte */
|
||||||
|
return MmProtectToValue[Pfn->OriginalPte.u.Soft.Protection];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is hardware PTE */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
ASSERT(FALSE);
|
||||||
|
|
||||||
|
return PAGE_NOACCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
MiQueryAddressState(IN PVOID Va,
|
MiQueryAddressState(IN PVOID Va,
|
||||||
|
@ -1119,9 +1161,9 @@ MiQueryAddressState(IN PVOID Va,
|
||||||
{
|
{
|
||||||
/* This means it's committed */
|
/* This means it's committed */
|
||||||
State = MEM_COMMIT;
|
State = MEM_COMMIT;
|
||||||
|
|
||||||
/* For now, we lie about the protection */
|
/* Get protection state of this page */
|
||||||
Protect = PAGE_EXECUTE_READWRITE;
|
Protect = MiGetPageProtection(PointerPte);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2306,7 +2348,7 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PMMVAD Vad = NULL;
|
PMMVAD Vad = NULL;
|
||||||
PVOID Address, NextAddress;
|
PVOID Address, NextAddress;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found = FALSE;
|
||||||
ULONG NewProtect, NewState, BaseVpn;
|
ULONG NewProtect, NewState, BaseVpn;
|
||||||
MEMORY_BASIC_INFORMATION MemoryInfo;
|
MEMORY_BASIC_INFORMATION MemoryInfo;
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
@ -2329,9 +2371,34 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
if ((BaseAddress > MM_HIGHEST_VAD_ADDRESS) ||
|
if ((BaseAddress > MM_HIGHEST_VAD_ADDRESS) ||
|
||||||
(PAGE_ALIGN(BaseAddress) == (PVOID)USER_SHARED_DATA))
|
(PAGE_ALIGN(BaseAddress) == (PVOID)USER_SHARED_DATA))
|
||||||
{
|
{
|
||||||
/* FIXME: We should return some bogus info structure */
|
Address = PAGE_ALIGN(BaseAddress);
|
||||||
UNIMPLEMENTED;
|
|
||||||
while (TRUE);
|
/* Make up an info structure describing this range */
|
||||||
|
MemoryInfo.BaseAddress = Address;
|
||||||
|
MemoryInfo.AllocationProtect = PAGE_READONLY;
|
||||||
|
MemoryInfo.Type = MEM_PRIVATE;
|
||||||
|
|
||||||
|
/* Special case for shared data */
|
||||||
|
if (Address == (PVOID)USER_SHARED_DATA)
|
||||||
|
{
|
||||||
|
MemoryInfo.AllocationBase = (PVOID)USER_SHARED_DATA;
|
||||||
|
MemoryInfo.State = MEM_COMMIT;
|
||||||
|
MemoryInfo.Protect = PAGE_READONLY;
|
||||||
|
MemoryInfo.RegionSize = PAGE_SIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MemoryInfo.AllocationBase = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1;
|
||||||
|
MemoryInfo.State = MEM_RESERVE;
|
||||||
|
MemoryInfo.Protect = PAGE_NOACCESS;
|
||||||
|
MemoryInfo.RegionSize = (ULONG_PTR)MemoryInfo.AllocationBase - (ULONG_PTR)Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the data (FIXME: Use SEH) */
|
||||||
|
*(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo;
|
||||||
|
if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this is for a local or remote process */
|
/* Check if this is for a local or remote process */
|
||||||
|
@ -2390,11 +2457,61 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
/* Was a VAD found? */
|
/* Was a VAD found? */
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
/* We don't handle this yet */
|
Address = PAGE_ALIGN(BaseAddress);
|
||||||
UNIMPLEMENTED;
|
|
||||||
while (TRUE);
|
/* Calculate region size */
|
||||||
|
if (Vad)
|
||||||
|
{
|
||||||
|
if (Vad->StartingVpn >= BaseVpn)
|
||||||
|
{
|
||||||
|
/* Region size is the free space till the start of that VAD */
|
||||||
|
MemoryInfo.RegionSize = (ULONG_PTR)(Vad->StartingVpn << PAGE_SHIFT) - (ULONG_PTR)Address;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get the next VAD */
|
||||||
|
Vad = (PMMVAD)MiGetNextNode((PMMADDRESS_NODE)Vad);
|
||||||
|
if (Vad)
|
||||||
|
{
|
||||||
|
/* Region size is the free space till the start of that VAD */
|
||||||
|
MemoryInfo.RegionSize = (ULONG_PTR)(Vad->StartingVpn << PAGE_SHIFT) - (ULONG_PTR)Address;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Maximum possible region size with that base address */
|
||||||
|
MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Maximum possible region size with that base address */
|
||||||
|
MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if we were attached */
|
||||||
|
if (ProcessHandle != NtCurrentProcess())
|
||||||
|
{
|
||||||
|
/* Detach and derefernece the process */
|
||||||
|
KeUnstackDetachProcess(&ApcState);
|
||||||
|
ObDereferenceObject(TargetProcess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Build the rest of the initial information block */
|
||||||
|
MemoryInfo.BaseAddress = Address;
|
||||||
|
MemoryInfo.AllocationBase = NULL;
|
||||||
|
MemoryInfo.AllocationProtect = 0;
|
||||||
|
MemoryInfo.State = MEM_FREE;
|
||||||
|
MemoryInfo.Protect = PAGE_NOACCESS;
|
||||||
|
MemoryInfo.Type = 0;
|
||||||
|
|
||||||
|
/* Return the data (FIXME: Use SEH) */
|
||||||
|
*(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo;
|
||||||
|
if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This must be a VM VAD */
|
/* This must be a VM VAD */
|
||||||
ASSERT(Vad->u.VadFlags.PrivateMemory);
|
ASSERT(Vad->u.VadFlags.PrivateMemory);
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,10 @@ DtbgWindowProc(HWND Wnd,
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case WM_DISPLAYCHANGE:
|
||||||
|
MoveWindow(Wnd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
PPRIVATE_NOTIFY_DESKTOP nmh = (PPRIVATE_NOTIFY_DESKTOP)lParam;
|
PPRIVATE_NOTIFY_DESKTOP nmh = (PPRIVATE_NOTIFY_DESKTOP)lParam;
|
||||||
|
|
|
@ -12,7 +12,8 @@ add_definitions(-DLANGPACK)
|
||||||
add_definitions(-D_WIN32K_)
|
add_definitions(-D_WIN32K_)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
dib/dib1bpp.c
|
dib/alphablend.c
|
||||||
|
dib/dib1bpp.c
|
||||||
dib/dib4bpp.c
|
dib/dib4bpp.c
|
||||||
dib/dib8bpp.c
|
dib/dib8bpp.c
|
||||||
dib/dib16bpp.c
|
dib/dib16bpp.c
|
||||||
|
@ -34,12 +35,15 @@ list(APPEND SOURCE
|
||||||
eng/float.c
|
eng/float.c
|
||||||
eng/gradient.c
|
eng/gradient.c
|
||||||
eng/lineto.c
|
eng/lineto.c
|
||||||
|
eng/ldevobj.c
|
||||||
eng/mapping.c
|
eng/mapping.c
|
||||||
eng/mem.c
|
eng/mem.c
|
||||||
eng/engmisc.c
|
eng/engmisc.c
|
||||||
eng/mouse.c
|
eng/mouse.c
|
||||||
eng/paint.c
|
eng/paint.c
|
||||||
|
eng/pdevobj.c
|
||||||
eng/perfcnt.c
|
eng/perfcnt.c
|
||||||
|
eng/rlecomp.c
|
||||||
eng/semaphor.c
|
eng/semaphor.c
|
||||||
eng/sort.c
|
eng/sort.c
|
||||||
eng/string.c
|
eng/string.c
|
||||||
|
@ -48,7 +52,6 @@ list(APPEND SOURCE
|
||||||
eng/transblt.c
|
eng/transblt.c
|
||||||
eng/engwindow.c
|
eng/engwindow.c
|
||||||
eng/xlate.c
|
eng/xlate.c
|
||||||
ldr/loader.c
|
|
||||||
main/dllmain.c
|
main/dllmain.c
|
||||||
misc/driver.c
|
misc/driver.c
|
||||||
misc/err.c
|
misc/err.c
|
||||||
|
|
123
subsystems/win32/win32k/dib/alphablend.c
Normal file
123
subsystems/win32/win32k/dib/alphablend.c
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: Win32 subsystem
|
||||||
|
* LICENSE: See COPYING in the top level directory
|
||||||
|
* FILE: subsystems/win32/win32k/dib/stretchblt.c
|
||||||
|
* PURPOSE: AlphaBlend implementation suitable for all bit depths
|
||||||
|
* PROGRAMMERS: Jérôme Gardou
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <win32k.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
ULONG ul;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
UCHAR red;
|
||||||
|
UCHAR green;
|
||||||
|
UCHAR blue;
|
||||||
|
UCHAR alpha;
|
||||||
|
} col;
|
||||||
|
} NICEPIXEL32;
|
||||||
|
|
||||||
|
static __inline UCHAR
|
||||||
|
Clamp8(ULONG val)
|
||||||
|
{
|
||||||
|
return (val > 255) ? 255 : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
DIB_XXBPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
|
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
||||||
|
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
||||||
|
{
|
||||||
|
INT DstX, DstY, SrcX, SrcY;
|
||||||
|
BLENDFUNCTION BlendFunc;
|
||||||
|
register NICEPIXEL32 DstPixel32;
|
||||||
|
register NICEPIXEL32 SrcPixel32;
|
||||||
|
UCHAR Alpha, SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
||||||
|
EXLATEOBJ* pexlo;
|
||||||
|
EXLATEOBJ exloSrcRGB, exloDstRGB, exloRGBSrc;
|
||||||
|
PFN_DIB_PutPixel pfnDibPutPixel = DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel;
|
||||||
|
|
||||||
|
DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
||||||
|
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
||||||
|
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
|
BlendFunc = BlendObj->BlendFunction;
|
||||||
|
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
||||||
|
{
|
||||||
|
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (BlendFunc.BlendFlags != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("BlendFlags != 0\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
||||||
|
SrcBpp != 32)
|
||||||
|
{
|
||||||
|
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ColorTranslation)
|
||||||
|
{
|
||||||
|
DPRINT1("ColorTranslation must not be NULL!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
|
||||||
|
EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
|
||||||
|
EXLATEOBJ_vInitialize(&exloDstRGB, pexlo->ppalDst, &gpalRGB, 0, 0, 0);
|
||||||
|
EXLATEOBJ_vInitialize(&exloRGBSrc, &gpalRGB, pexlo->ppalSrc, 0, 0, 0);
|
||||||
|
|
||||||
|
SrcY = SourceRect->top;
|
||||||
|
DstY = DestRect->top;
|
||||||
|
while ( DstY < DestRect->bottom )
|
||||||
|
{
|
||||||
|
SrcX = SourceRect->left;
|
||||||
|
DstX = DestRect->left;
|
||||||
|
while(DstX < DestRect->right)
|
||||||
|
{
|
||||||
|
SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
|
||||||
|
SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
|
||||||
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
|
(SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
|
||||||
|
BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
|
DstPixel32.ul = DIB_GetSource(Dest, DstX, DstY, &exloDstRGB.xlo);
|
||||||
|
DstPixel32.col.red = Clamp8((DstPixel32.col.red * (255 - Alpha)) / 255 + SrcPixel32.col.red) ;
|
||||||
|
DstPixel32.col.green = Clamp8((DstPixel32.col.green * (255 - Alpha)) / 255 + SrcPixel32.col.green) ;
|
||||||
|
DstPixel32.col.blue = Clamp8((DstPixel32.col.blue * (255 - Alpha)) / 255 + SrcPixel32.col.blue) ;
|
||||||
|
DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
|
||||||
|
pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
|
||||||
|
|
||||||
|
DstX++;
|
||||||
|
SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
|
||||||
|
/(DestRect->right-DestRect->left);
|
||||||
|
}
|
||||||
|
DstY++;
|
||||||
|
SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
|
||||||
|
/(DestRect->bottom-DestRect->top);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXLATEOBJ_vCleanup(&exloDstRGB);
|
||||||
|
EXLATEOBJ_vCleanup(&exloRGBSrc);
|
||||||
|
EXLATEOBJ_vCleanup(&exloSrcRGB);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -29,25 +29,25 @@ DIB_FUNCTIONS DibFunctionsForBitmapFormat[] =
|
||||||
{
|
{
|
||||||
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine,
|
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine,
|
||||||
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_1BPP_AlphaBlend
|
DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_XXBPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_4BPP */
|
/* BMF_4BPP */
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine,
|
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine,
|
||||||
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_4BPP_AlphaBlend
|
DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_XXBPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_8BPP */
|
/* BMF_8BPP */
|
||||||
{
|
{
|
||||||
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine,
|
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine,
|
||||||
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_8BPP_AlphaBlend
|
DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_XXBPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_16BPP */
|
/* BMF_16BPP */
|
||||||
{
|
{
|
||||||
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine,
|
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine,
|
||||||
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_16BPP_AlphaBlend
|
DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_XXBPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_24BPP */
|
/* BMF_24BPP */
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ BOOLEAN DIB_1BPP_BitBlt(PBLTINFO);
|
||||||
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
|
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
|
||||||
BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
||||||
BOOLEAN DIB_1BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
BOOLEAN DIB_1BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
||||||
BOOLEAN DIB_1BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
|
|
||||||
|
|
||||||
VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
||||||
ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
||||||
|
@ -88,7 +87,6 @@ BOOLEAN DIB_4BPP_BitBlt(PBLTINFO);
|
||||||
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
|
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
|
||||||
BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
||||||
BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
||||||
BOOLEAN DIB_4BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
|
|
||||||
|
|
||||||
VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
||||||
ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
||||||
|
@ -98,7 +96,6 @@ BOOLEAN DIB_8BPP_BitBlt(PBLTINFO);
|
||||||
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
|
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
|
||||||
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
||||||
BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
||||||
BOOLEAN DIB_8BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
|
|
||||||
|
|
||||||
VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
||||||
ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
||||||
|
@ -108,7 +105,6 @@ BOOLEAN DIB_16BPP_BitBlt(PBLTINFO);
|
||||||
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
|
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
|
||||||
BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
|
||||||
BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
|
||||||
BOOLEAN DIB_16BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
|
|
||||||
|
|
||||||
VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
|
||||||
ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
|
||||||
|
@ -132,6 +128,7 @@ BOOLEAN DIB_32BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATE
|
||||||
|
|
||||||
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4);
|
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4);
|
||||||
BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ*, BRUSHOBJ*, RECTL*, POINTL*, ULONG, UINT);
|
BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ*, BRUSHOBJ*, RECTL*, POINTL*, ULONG, UINT);
|
||||||
|
BOOLEAN DIB_XXBPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
|
||||||
|
|
||||||
extern unsigned char notmask[2];
|
extern unsigned char notmask[2];
|
||||||
extern unsigned char altnotmask[2];
|
extern unsigned char altnotmask[2];
|
||||||
|
|
|
@ -525,174 +525,4 @@ DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
ULONG ul;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
UCHAR red;
|
|
||||||
UCHAR green;
|
|
||||||
UCHAR blue;
|
|
||||||
UCHAR alpha;
|
|
||||||
} col;
|
|
||||||
} NICEPIXEL32;
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
USHORT us;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
USHORT red:5,
|
|
||||||
green:6,
|
|
||||||
blue:5;
|
|
||||||
} col;
|
|
||||||
} NICEPIXEL16;
|
|
||||||
|
|
||||||
static __inline UCHAR
|
|
||||||
Clamp5(ULONG val)
|
|
||||||
{
|
|
||||||
return (val > 31) ? 31 : val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline UCHAR
|
|
||||||
Clamp8(ULONG val)
|
|
||||||
{
|
|
||||||
return (val > 255) ? 255 : val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline UCHAR
|
|
||||||
Clamp6(ULONG val)
|
|
||||||
{
|
|
||||||
return (val > 63) ? 63 : val;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
DIB_16BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
|
||||||
{
|
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
|
||||||
register PUSHORT Dst;
|
|
||||||
ULONG DstDelta;
|
|
||||||
BLENDFUNCTION BlendFunc;
|
|
||||||
register NICEPIXEL16 SrcPixel16;
|
|
||||||
register NICEPIXEL16 DstPixel16;
|
|
||||||
register NICEPIXEL32 SrcPixel32;
|
|
||||||
register NICEPIXEL32 DstPixel32;
|
|
||||||
UCHAR Alpha, SrcBpp;
|
|
||||||
EXLATEOBJ *pexlo;
|
|
||||||
EXLATEOBJ exloDst2Src;
|
|
||||||
|
|
||||||
DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
|
||||||
{
|
|
||||||
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (BlendFunc.BlendFlags != 0)
|
|
||||||
{
|
|
||||||
DPRINT1("BlendFlags != 0\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
|
||||||
{
|
|
||||||
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
|
||||||
BitsPerFormat(Source->iBitmapFormat) != 32)
|
|
||||||
{
|
|
||||||
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ColorTranslation)
|
|
||||||
{
|
|
||||||
DPRINT1("ColorTranslation must not be NULL!\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
|
|
||||||
EXLATEOBJ_vInitialize(&exloDst2Src, pexlo->ppalDst, pexlo->ppalSrc, 0, 0, 0);
|
|
||||||
|
|
||||||
Dst = (PUSHORT)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
|
||||||
(DestRect->left << 1));
|
|
||||||
DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 1);
|
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
|
||||||
SrcY = SourceRect->top;
|
|
||||||
while (--Rows >= 0)
|
|
||||||
{
|
|
||||||
Cols = DestRect->right - DestRect->left;
|
|
||||||
SrcX = SourceRect->left;
|
|
||||||
while (--Cols >= 0)
|
|
||||||
{
|
|
||||||
if (SrcBpp <= 16)
|
|
||||||
{
|
|
||||||
SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
|
||||||
SrcPixel32.col.red = (SrcPixel16.col.red << 3);
|
|
||||||
SrcPixel32.col.green = (SrcPixel16.col.green << 2);
|
|
||||||
SrcPixel32.col.blue = (SrcPixel16.col.blue << 3);
|
|
||||||
|
|
||||||
SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.alpha = (SrcBpp == 32) ?
|
|
||||||
(SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) :
|
|
||||||
BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
DstPixel16.us = *Dst;
|
|
||||||
DstPixel16.col.red = Clamp5(DstPixel16.col.red * (255 - Alpha) / 255 +
|
|
||||||
(SrcPixel32.col.red >> 3));
|
|
||||||
|
|
||||||
DstPixel16.col.green = Clamp6(DstPixel16.col.green * (255 - Alpha) / 255 +
|
|
||||||
(SrcPixel32.col.green >> 2));
|
|
||||||
|
|
||||||
DstPixel16.col.blue = Clamp5(DstPixel16.col.blue * (255 - Alpha) / 255 +
|
|
||||||
(SrcPixel32.col.blue >> 3));
|
|
||||||
|
|
||||||
*Dst++ = DstPixel16.us;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY);
|
|
||||||
|
|
||||||
SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.alpha = (SrcBpp == 32) ?
|
|
||||||
(SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) :
|
|
||||||
BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
DstPixel32.ul = XLATEOBJ_iXlate(&exloDst2Src.xlo, *Dst);
|
|
||||||
SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red);
|
|
||||||
SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green);
|
|
||||||
SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue);
|
|
||||||
*Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Dst = (PUSHORT)((ULONG_PTR)Dst + DstDelta);
|
|
||||||
SrcY++;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXLATEOBJ_vCleanup(&exloDst2Src);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -33,7 +33,7 @@ DIB_1BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
|
||||||
VOID
|
VOID
|
||||||
DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
while(x1 < x2)
|
while(x1 < x2)
|
||||||
{
|
{
|
||||||
DIB_1BPP_PutPixel(SurfObj, x1, y, c);
|
DIB_1BPP_PutPixel(SurfObj, x1, y, c);
|
||||||
x1++;
|
x1++;
|
||||||
|
@ -43,7 +43,7 @@ DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
VOID
|
VOID
|
||||||
DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
while(y1 < y2)
|
while(y1 < y2)
|
||||||
{
|
{
|
||||||
DIB_1BPP_PutPixel(SurfObj, x, y1, c);
|
DIB_1BPP_PutPixel(SurfObj, x, y1, c);
|
||||||
y1++;
|
y1++;
|
||||||
|
@ -474,13 +474,4 @@ DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
DIB_1BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -37,7 +37,7 @@ DIB_24BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
c &= 0xFFFFFF;
|
c &= 0xFFFFFF;
|
||||||
while(y1++ < y2)
|
while(y1++ < y2)
|
||||||
{
|
{
|
||||||
*(PUSHORT)(addr) = c & 0xFFFF;
|
*(PUSHORT)(addr) = c & 0xFFFF;
|
||||||
*(addr + 2) = c >> 16;
|
*(addr + 2) = c >> 16;
|
||||||
|
@ -466,7 +466,6 @@ DIB_24BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
{
|
{
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
INT Rows, Cols, SrcX, SrcY;
|
||||||
register PUCHAR Dst;
|
register PUCHAR Dst;
|
||||||
ULONG DstDelta;
|
|
||||||
BLENDFUNCTION BlendFunc;
|
BLENDFUNCTION BlendFunc;
|
||||||
register NICEPIXEL32 DstPixel, SrcPixel;
|
register NICEPIXEL32 DstPixel, SrcPixel;
|
||||||
UCHAR Alpha, SrcBpp;
|
UCHAR Alpha, SrcBpp;
|
||||||
|
@ -475,9 +474,6 @@ DIB_24BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
BlendFunc = BlendObj->BlendFunction;
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
||||||
{
|
{
|
||||||
|
@ -503,39 +499,41 @@ DIB_24BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
|
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
||||||
(DestRect->left * 3));
|
(DestRect->left * 3));
|
||||||
DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) * 3);
|
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
Rows = 0;
|
||||||
SrcY = SourceRect->top;
|
SrcY = SourceRect->top;
|
||||||
while (--Rows >= 0)
|
while (++Rows <= DestRect->bottom - DestRect->top)
|
||||||
{
|
{
|
||||||
Cols = DestRect->right - DestRect->left;
|
Cols = 0;
|
||||||
SrcX = SourceRect->left;
|
SrcX = SourceRect->left;
|
||||||
while (--Cols >= 0)
|
while (++Cols <= DestRect->right - DestRect->left)
|
||||||
|
{
|
||||||
|
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
||||||
|
SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
if (!(BlendFunc.AlphaFormat & AC_SRC_ALPHA))
|
||||||
{
|
{
|
||||||
SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
Alpha = BlendFunc.SourceConstantAlpha ;
|
||||||
SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
/* copy only 24bits of dst */
|
|
||||||
DstPixel.ul = *(PUSHORT)(Dst) + (*(Dst+2) << 16);
|
|
||||||
DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red);
|
|
||||||
DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green);
|
|
||||||
DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue);
|
|
||||||
/* copy back 24bits of result */
|
|
||||||
*(PUSHORT)(Dst) = (USHORT)(DstPixel.ul & 0xFFFF);
|
|
||||||
*(Dst + 2) = (UCHAR)((DstPixel.ul >> 16) & 0xFF);
|
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dst + 3);
|
|
||||||
}
|
}
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta);
|
else
|
||||||
SrcY++;
|
{
|
||||||
}
|
Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
DstPixel.col.red = Clamp8((*Dst * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
|
||||||
|
DstPixel.col.green = Clamp8((*(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green)) ;
|
||||||
|
DstPixel.col.blue = Clamp8((*(Dst+2) * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
|
||||||
|
*Dst++ = DstPixel.col.red;
|
||||||
|
*Dst++ = DstPixel.col.green;
|
||||||
|
*Dst++ = DstPixel.col.blue;
|
||||||
|
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
|
||||||
|
}
|
||||||
|
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) +
|
||||||
|
(DestRect->left*3));
|
||||||
|
SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
PDWORD Source32, Dest32;
|
PDWORD Source32, Dest32;
|
||||||
|
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
|
||||||
+ (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
|
+ (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
|
||||||
+ 4 * BltInfo->DestRect.left;
|
+ 4 * BltInfo->DestRect.left;
|
||||||
|
|
||||||
switch (BltInfo->SourceSurface->iBitmapFormat)
|
switch (BltInfo->SourceSurface->iBitmapFormat)
|
||||||
|
@ -83,8 +83,8 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_4BPP:
|
case BMF_4BPP:
|
||||||
SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
|
SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
||||||
+ (BltInfo->SourcePoint.x >> 1);
|
+ (BltInfo->SourcePoint.x >> 1);
|
||||||
|
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
|
@ -156,8 +156,8 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_24BPP:
|
case BMF_24BPP:
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
||||||
+ 3 * BltInfo->SourcePoint.x;
|
+ 3 * BltInfo->SourcePoint.x;
|
||||||
DestLine = DestBits;
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_32BPP:
|
case BMF_32BPP:
|
||||||
if (NULL == BltInfo->XlateSourceToDest ||
|
if (NULL == BltInfo->XlateSourceToDest ||
|
||||||
0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
||||||
{
|
{
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
|
@ -197,10 +197,10 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
+ ((BltInfo->SourcePoint.y
|
+ ((BltInfo->SourcePoint.y
|
||||||
+ BltInfo->DestRect.bottom
|
+ BltInfo->DestRect.bottom
|
||||||
- BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta)
|
- BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta)
|
||||||
+ 4 * BltInfo->SourcePoint.x;
|
+ 4 * BltInfo->SourcePoint.x;
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
|
@ -348,7 +348,6 @@ DIB_32BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
{
|
{
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
INT Rows, Cols, SrcX, SrcY;
|
||||||
register PULONG Dst;
|
register PULONG Dst;
|
||||||
ULONG DstDelta;
|
|
||||||
BLENDFUNCTION BlendFunc;
|
BLENDFUNCTION BlendFunc;
|
||||||
register NICEPIXEL32 DstPixel, SrcPixel;
|
register NICEPIXEL32 DstPixel, SrcPixel;
|
||||||
UCHAR Alpha, SrcBpp;
|
UCHAR Alpha, SrcBpp;
|
||||||
|
@ -357,9 +356,6 @@ DIB_32BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
BlendFunc = BlendObj->BlendFunction;
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
||||||
{
|
{
|
||||||
|
@ -385,35 +381,38 @@ DIB_32BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
|
|
||||||
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
||||||
(DestRect->left << 2));
|
(DestRect->left << 2));
|
||||||
DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 2);
|
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
Rows = 0;
|
||||||
SrcY = SourceRect->top;
|
SrcY = SourceRect->top;
|
||||||
while (--Rows >= 0)
|
while (++Rows <= DestRect->bottom - DestRect->top)
|
||||||
{
|
{
|
||||||
Cols = DestRect->right - DestRect->left;
|
Cols = 0;
|
||||||
SrcX = SourceRect->left;
|
SrcX = SourceRect->left;
|
||||||
while (--Cols >= 0)
|
while (++Cols <= DestRect->right - DestRect->left)
|
||||||
{
|
{
|
||||||
SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
||||||
SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
SrcPixel.col.alpha = (32 == SrcBpp) ?
|
||||||
|
(SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
|
||||||
|
BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha;
|
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
DstPixel.ul = *Dst;
|
DstPixel.ul = *Dst;
|
||||||
DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red);
|
DstPixel.col.red = Clamp8((DstPixel.col.red * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
|
||||||
DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green);
|
DstPixel.col.green = Clamp8((DstPixel.col.green * (255 - Alpha)) / 255 + SrcPixel.col.green) ;
|
||||||
DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue);
|
DstPixel.col.blue = Clamp8((DstPixel.col.blue * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
|
||||||
DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha);
|
DstPixel.col.alpha = Clamp8((DstPixel.col.alpha * (255 - Alpha)) / 255 + SrcPixel.col.alpha) ;
|
||||||
*Dst++ = DstPixel.ul;
|
*Dst++ = DstPixel.ul;
|
||||||
|
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
|
||||||
}
|
}
|
||||||
Dst = (PULONG)((ULONG_PTR)Dst + DstDelta);
|
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) +
|
||||||
SrcY++;
|
(DestRect->left << 2));
|
||||||
|
SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -32,7 +32,7 @@ DIB_4BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
|
PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
while(cx < x2)
|
while(cx < x2)
|
||||||
{
|
{
|
||||||
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
||||||
if((++x1 & 1) == 0)
|
if((++x1 & 1) == 0)
|
||||||
|
@ -48,7 +48,7 @@ DIB_4BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
int lDelta = SurfObj->lDelta;
|
int lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
addr += (x>>1) + y1 * lDelta;
|
addr += (x>>1) + y1 * lDelta;
|
||||||
while(y1++ < y2)
|
while(y1++ < y2)
|
||||||
{
|
{
|
||||||
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
||||||
addr += lDelta;
|
addr += lDelta;
|
||||||
|
@ -81,8 +81,8 @@ DIB_4BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
||||||
}
|
}
|
||||||
|
@ -375,13 +375,4 @@ DIB_4BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
DIB_4BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -43,7 +43,7 @@ DIB_8BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
byteaddr = addr;
|
byteaddr = addr;
|
||||||
while(y1++ < y2)
|
while(y1++ < y2)
|
||||||
{
|
{
|
||||||
*addr = c;
|
*addr = c;
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
||||||
{
|
{
|
||||||
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
||||||
}
|
}
|
||||||
|
@ -362,130 +362,4 @@ DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union {
|
|
||||||
ULONG ul;
|
|
||||||
struct {
|
|
||||||
UCHAR red;
|
|
||||||
UCHAR green;
|
|
||||||
UCHAR blue;
|
|
||||||
UCHAR alpha;
|
|
||||||
} col;
|
|
||||||
} NICEPIXEL32;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
USHORT us;
|
|
||||||
struct {
|
|
||||||
USHORT red:5,
|
|
||||||
green:6,
|
|
||||||
blue:5;
|
|
||||||
} col;
|
|
||||||
} NICEPIXEL16;
|
|
||||||
|
|
||||||
static __inline UCHAR
|
|
||||||
Clamp8(ULONG val)
|
|
||||||
{
|
|
||||||
return (val > 255) ? 255 : val;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
DIB_8BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
|
||||||
{
|
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
|
||||||
register PUCHAR Dst;
|
|
||||||
ULONG DstDelta;
|
|
||||||
BLENDFUNCTION BlendFunc;
|
|
||||||
register NICEPIXEL32 DstPixel32;
|
|
||||||
register NICEPIXEL32 SrcPixel32;
|
|
||||||
register NICEPIXEL16 SrcPixel16;
|
|
||||||
UCHAR Alpha, SrcBpp;
|
|
||||||
EXLATEOBJ exloDst2Src;
|
|
||||||
EXLATEOBJ* pexlo;
|
|
||||||
|
|
||||||
DPRINT("DIB_8BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
|
||||||
{
|
|
||||||
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (BlendFunc.BlendFlags != 0)
|
|
||||||
{
|
|
||||||
DPRINT1("BlendFlags != 0\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
|
||||||
{
|
|
||||||
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
|
||||||
BitsPerFormat(Source->iBitmapFormat) != 32)
|
|
||||||
{
|
|
||||||
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!ColorTranslation)
|
|
||||||
{
|
|
||||||
DPRINT1("ColorTranslation must not be NULL!\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
|
|
||||||
EXLATEOBJ_vInitialize(&exloDst2Src, pexlo->ppalDst, pexlo->ppalSrc, 0, 0, 0);
|
|
||||||
|
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
|
||||||
DestRect->left);
|
|
||||||
DstDelta = Dest->lDelta - (DestRect->right - DestRect->left);
|
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
|
||||||
SrcY = SourceRect->top;
|
|
||||||
while (--Rows >= 0)
|
|
||||||
{
|
|
||||||
Cols = DestRect->right - DestRect->left;
|
|
||||||
SrcX = SourceRect->left;
|
|
||||||
while (--Cols >= 0)
|
|
||||||
{
|
|
||||||
if (SrcBpp <= 16)
|
|
||||||
{
|
|
||||||
SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
|
||||||
SrcPixel32.col.red = (SrcPixel16.col.red << 3) | (SrcPixel16.col.red >> 2);
|
|
||||||
SrcPixel32.col.green = (SrcPixel16.col.green << 2) | (SrcPixel16.col.green >> 4);
|
|
||||||
SrcPixel32.col.blue = (SrcPixel16.col.blue << 3) | (SrcPixel16.col.blue >> 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY);
|
|
||||||
}
|
|
||||||
SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.alpha = (SrcBpp == 32) ? (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
DstPixel32.ul = XLATEOBJ_iXlate(&exloDst2Src.xlo, *Dst);
|
|
||||||
SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red);
|
|
||||||
SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green);
|
|
||||||
SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue);
|
|
||||||
*Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul);
|
|
||||||
}
|
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta);
|
|
||||||
SrcY++;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXLATEOBJ_vCleanup(&exloDst2Src);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: GDI alpha blending functions
|
* PURPOSE: GDI alpha blending functions
|
||||||
|
@ -25,10 +25,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
IN PRECTL SourceRect,
|
IN PRECTL SourceRect,
|
||||||
IN BLENDOBJ *BlendObj)
|
IN BLENDOBJ *BlendObj)
|
||||||
{
|
{
|
||||||
RECTL SourceStretchedRect;
|
|
||||||
SIZEL SourceStretchedSize;
|
|
||||||
HBITMAP SourceStretchedBitmap = 0;
|
|
||||||
SURFOBJ* SourceStretchedObj = NULL;
|
|
||||||
RECTL InputRect;
|
RECTL InputRect;
|
||||||
RECTL OutputRect;
|
RECTL OutputRect;
|
||||||
RECTL ClipRect;
|
RECTL ClipRect;
|
||||||
|
@ -39,7 +35,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
INTENG_ENTER_LEAVE EnterLeaveDest;
|
INTENG_ENTER_LEAVE EnterLeaveDest;
|
||||||
SURFOBJ* InputObj;
|
SURFOBJ* InputObj;
|
||||||
SURFOBJ* OutputObj;
|
SURFOBJ* OutputObj;
|
||||||
LONG Width;
|
|
||||||
LONG ClippingType;
|
LONG ClippingType;
|
||||||
RECT_ENUM RectEnum;
|
RECT_ENUM RectEnum;
|
||||||
BOOL EnumMore;
|
BOOL EnumMore;
|
||||||
|
@ -71,7 +66,7 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
InputRect = *SourceRect;
|
InputRect = *SourceRect;
|
||||||
if ( (InputRect.top < 0) || (InputRect.bottom < 0) ||
|
if ( (InputRect.top < 0) || (InputRect.bottom < 0) ||
|
||||||
(InputRect.left < 0) || (InputRect.right < 0) ||
|
(InputRect.left < 0) || (InputRect.right < 0) ||
|
||||||
InputRect.right > psoSource->sizlBitmap.cx ||
|
InputRect.right > psoSource->sizlBitmap.cx ||
|
||||||
InputRect.bottom > psoSource->sizlBitmap.cy )
|
InputRect.bottom > psoSource->sizlBitmap.cy )
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -111,68 +106,9 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stretch source if needed */
|
|
||||||
if (OutputRect.right - OutputRect.left != InputRect.right - InputRect.left ||
|
|
||||||
OutputRect.bottom - OutputRect.top != InputRect.bottom - InputRect.top)
|
|
||||||
{
|
|
||||||
SourceStretchedSize.cx = OutputRect.right - OutputRect.left;
|
|
||||||
SourceStretchedSize.cy = OutputRect.bottom - OutputRect.top;
|
|
||||||
Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(psoSource->iBitmapFormat));
|
|
||||||
/* FIXME: Maybe it is a good idea to use EngCreateDeviceBitmap and IntEngStretchBlt
|
|
||||||
if possible to get a HW accelerated stretch. */
|
|
||||||
SourceStretchedBitmap = EngCreateBitmap(SourceStretchedSize, Width, psoSource->iBitmapFormat,
|
|
||||||
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
|
||||||
if (SourceStretchedBitmap == 0)
|
|
||||||
{
|
|
||||||
DPRINT1("EngCreateBitmap failed!\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
SourceStretchedObj = EngLockSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
if (SourceStretchedObj == NULL)
|
|
||||||
{
|
|
||||||
DPRINT1("EngLockSurface failed!\n");
|
|
||||||
EngDeleteSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceStretchedRect.left = 0;
|
|
||||||
SourceStretchedRect.right = SourceStretchedSize.cx;
|
|
||||||
SourceStretchedRect.top = 0;
|
|
||||||
SourceStretchedRect.bottom = SourceStretchedSize.cy;
|
|
||||||
/* FIXME: IntEngStretchBlt isn't used here atm because it results in a
|
|
||||||
try to acquire an already acquired mutex (lock the already locked source surface) */
|
|
||||||
/*if (!IntEngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL,
|
|
||||||
NULL, &SourceStretchedRect, SourceRect, NULL,
|
|
||||||
NULL, NULL, COLORONCOLOR))*/
|
|
||||||
if (!EngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL, NULL,
|
|
||||||
NULL, NULL, &SourceStretchedRect, &InputRect,
|
|
||||||
NULL, COLORONCOLOR))
|
|
||||||
{
|
|
||||||
DPRINT1("EngStretchBlt failed!\n");
|
|
||||||
EngFreeMem(SourceStretchedObj->pvBits);
|
|
||||||
EngUnlockSurface(SourceStretchedObj);
|
|
||||||
EngDeleteSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
InputRect.top = SourceStretchedRect.top;
|
|
||||||
InputRect.bottom = SourceStretchedRect.bottom;
|
|
||||||
InputRect.left = SourceStretchedRect.left;
|
|
||||||
InputRect.right = SourceStretchedRect.right;
|
|
||||||
psoSource = SourceStretchedObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now call the DIB function */
|
/* Now call the DIB function */
|
||||||
if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
|
if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
|
||||||
{
|
{
|
||||||
if (SourceStretchedObj != NULL)
|
|
||||||
{
|
|
||||||
EngFreeMem(SourceStretchedObj->pvBits);
|
|
||||||
EngUnlockSurface(SourceStretchedObj);
|
|
||||||
}
|
|
||||||
if (SourceStretchedBitmap != 0)
|
|
||||||
{
|
|
||||||
EngDeleteSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
InputRect.left += Translate.x;
|
InputRect.left += Translate.x;
|
||||||
|
@ -182,16 +118,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
|
|
||||||
if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
|
if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
|
||||||
{
|
{
|
||||||
IntEngLeave(&EnterLeaveSource);
|
|
||||||
if (SourceStretchedObj != NULL)
|
|
||||||
{
|
|
||||||
EngFreeMem(SourceStretchedObj->pvBits);
|
|
||||||
EngUnlockSurface(SourceStretchedObj);
|
|
||||||
}
|
|
||||||
if (SourceStretchedBitmap != 0)
|
|
||||||
{
|
|
||||||
EngDeleteSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
OutputRect.left += Translate.x;
|
OutputRect.left += Translate.x;
|
||||||
|
@ -261,16 +187,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
IntEngLeave(&EnterLeaveDest);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
IntEngLeave(&EnterLeaveSource);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
||||||
if (SourceStretchedObj != NULL)
|
|
||||||
{
|
|
||||||
EngFreeMem(SourceStretchedObj->pvBits);
|
|
||||||
EngUnlockSurface(SourceStretchedObj);
|
|
||||||
}
|
|
||||||
if (SourceStretchedBitmap != 0)
|
|
||||||
{
|
|
||||||
EngDeleteSurface((HSURF)SourceStretchedBitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,17 +221,8 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
|
||||||
MouseSafetyOnDrawStart(psoDest, DestRect->left, DestRect->top,
|
|
||||||
DestRect->right, DestRect->bottom);
|
|
||||||
|
|
||||||
if (psoSource != psoDest)
|
|
||||||
SURFACE_LockBitmapBits(psurfSource);
|
|
||||||
MouseSafetyOnDrawStart(psoSource, SourceRect->left, SourceRect->top,
|
|
||||||
SourceRect->right, SourceRect->bottom);
|
|
||||||
|
|
||||||
/* Call the driver's DrvAlphaBlend if available */
|
/* Call the driver's DrvAlphaBlend if available */
|
||||||
if (psurfDest->flHooks & HOOK_ALPHABLEND)
|
if (psurfDest->flags & HOOK_ALPHABLEND)
|
||||||
{
|
{
|
||||||
ret = GDIDEVFUNCS(psoDest).AlphaBlend(
|
ret = GDIDEVFUNCS(psoDest).AlphaBlend(
|
||||||
psoDest, psoSource, ClipRegion, ColorTranslation,
|
psoDest, psoSource, ClipRegion, ColorTranslation,
|
||||||
|
@ -328,12 +235,6 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
|
||||||
DestRect, SourceRect, BlendObj);
|
DestRect, SourceRect, BlendObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(psoSource);
|
|
||||||
if (psoSource != psoDest)
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,7 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
IntEngBitBltEx(
|
IntEngBitBlt(
|
||||||
SURFOBJ *psoTrg,
|
SURFOBJ *psoTrg,
|
||||||
SURFOBJ *psoSrc,
|
SURFOBJ *psoSrc,
|
||||||
SURFOBJ *psoMask,
|
SURFOBJ *psoMask,
|
||||||
|
@ -533,8 +533,7 @@ IntEngBitBltEx(
|
||||||
POINTL *pptlMask,
|
POINTL *pptlMask,
|
||||||
BRUSHOBJ *pbo,
|
BRUSHOBJ *pbo,
|
||||||
POINTL *pptlBrush,
|
POINTL *pptlBrush,
|
||||||
ROP4 rop4,
|
ROP4 rop4)
|
||||||
BOOL bRemoveMouse)
|
|
||||||
{
|
{
|
||||||
SURFACE *psurfTrg;
|
SURFACE *psurfTrg;
|
||||||
SURFACE *psurfSrc = NULL;
|
SURFACE *psurfSrc = NULL;
|
||||||
|
@ -583,28 +582,11 @@ IntEngBitBltEx(
|
||||||
psurfSrc = NULL;
|
psurfSrc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bRemoveMouse)
|
|
||||||
{
|
|
||||||
SURFACE_LockBitmapBits(psurfTrg);
|
|
||||||
|
|
||||||
if (psoSrc)
|
|
||||||
{
|
|
||||||
if (psoSrc != psoTrg)
|
|
||||||
{
|
|
||||||
SURFACE_LockBitmapBits(psurfSrc);
|
|
||||||
}
|
|
||||||
MouseSafetyOnDrawStart(psoSrc, rclSrc.left, rclSrc.top,
|
|
||||||
rclSrc.right, rclSrc.bottom);
|
|
||||||
}
|
|
||||||
MouseSafetyOnDrawStart(psoTrg, rclClipped.left, rclClipped.top,
|
|
||||||
rclClipped.right, rclClipped.bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is the target surface device managed? */
|
/* Is the target surface device managed? */
|
||||||
if (psurfTrg->flHooks & HOOK_BITBLT)
|
if (psurfTrg->flags & HOOK_BITBLT)
|
||||||
{
|
{
|
||||||
/* Is the source a different device managed surface? */
|
/* Is the source a different device managed surface? */
|
||||||
if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flHooks & HOOK_BITBLT)
|
if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flags & HOOK_BITBLT)
|
||||||
{
|
{
|
||||||
DPRINT1("Need to copy to standard bitmap format!\n");
|
DPRINT1("Need to copy to standard bitmap format!\n");
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
|
@ -614,7 +596,7 @@ IntEngBitBltEx(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the source surface device managed? */
|
/* Is the source surface device managed? */
|
||||||
else if (psoSrc && psurfSrc->flHooks & HOOK_BITBLT)
|
else if (psoSrc && psurfSrc->flags & HOOK_BITBLT)
|
||||||
{
|
{
|
||||||
pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt;
|
pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt;
|
||||||
}
|
}
|
||||||
|
@ -637,21 +619,6 @@ IntEngBitBltEx(
|
||||||
|
|
||||||
// FIXME: cleanup temp surface!
|
// FIXME: cleanup temp surface!
|
||||||
|
|
||||||
if (bRemoveMouse)
|
|
||||||
{
|
|
||||||
MouseSafetyOnDrawEnd(psoTrg);
|
|
||||||
if (psoSrc)
|
|
||||||
{
|
|
||||||
MouseSafetyOnDrawEnd(psoSrc);
|
|
||||||
if (psoSrc != psoTrg)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SURFACE_UnlockBitmapBits(psurfTrg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,27 +950,20 @@ IntEngMaskBlt(SURFOBJ *psoDest,
|
||||||
ASSERT(psoDest);
|
ASSERT(psoDest);
|
||||||
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
|
||||||
MouseSafetyOnDrawStart(psoDest, OutputRect.left, OutputRect.top,
|
|
||||||
OutputRect.right, OutputRect.bottom);
|
|
||||||
|
|
||||||
/* Dummy BitBlt to let driver know that it should flush its changes.
|
/* Dummy BitBlt to let driver know that it should flush its changes.
|
||||||
This should really be done using a call to DrvSynchronizeSurface,
|
This should really be done using a call to DrvSynchronizeSurface,
|
||||||
but the VMware driver doesn't hook that call. */
|
but the VMware driver doesn't hook that call. */
|
||||||
IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
|
IntEngBitBlt(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
|
||||||
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
|
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
|
||||||
R4_NOOP, FALSE);
|
R4_NOOP);
|
||||||
|
|
||||||
ret = EngMaskBitBlt(psoDest, psoMask, ClipRegion, DestColorTranslation, SourceColorTranslation,
|
ret = EngMaskBitBlt(psoDest, psoMask, ClipRegion, DestColorTranslation, SourceColorTranslation,
|
||||||
&OutputRect, &InputPoint, pbo, BrushOrigin);
|
&OutputRect, &InputPoint, pbo, BrushOrigin);
|
||||||
|
|
||||||
/* Dummy BitBlt to let driver know that something has changed. */
|
/* Dummy BitBlt to let driver know that something has changed. */
|
||||||
IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
|
IntEngBitBlt(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
|
||||||
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
|
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
|
||||||
R4_NOOP, FALSE);
|
R4_NOOP);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,13 +53,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL);
|
ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL);
|
||||||
|
|
||||||
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
||||||
SURFACE_LockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||||
if (psoDest != psoSource)
|
|
||||||
{
|
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
|
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
|
||||||
// mark the copy block function to be DrvCopyBits instead of the
|
// mark the copy block function to be DrvCopyBits instead of the
|
||||||
|
@ -73,7 +67,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
if (psoDest->iType!=STYPE_BITMAP)
|
if (psoDest->iType!=STYPE_BITMAP)
|
||||||
{
|
{
|
||||||
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
|
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
|
||||||
if (psurfDest->flHooks & HOOK_COPYBITS)
|
if (psurfDest->flags & HOOK_COPYBITS)
|
||||||
{
|
{
|
||||||
ret = GDIDEVFUNCS(psoDest).CopyBits(
|
ret = GDIDEVFUNCS(psoDest).CopyBits(
|
||||||
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
||||||
|
@ -86,7 +80,7 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
if (psoSource->iType!=STYPE_BITMAP)
|
if (psoSource->iType!=STYPE_BITMAP)
|
||||||
{
|
{
|
||||||
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
|
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
|
||||||
if (psurfSource->flHooks & HOOK_COPYBITS)
|
if (psurfSource->flags & HOOK_COPYBITS)
|
||||||
{
|
{
|
||||||
ret = GDIDEVFUNCS(psoSource).CopyBits(
|
ret = GDIDEVFUNCS(psoSource).CopyBits(
|
||||||
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
|
||||||
|
@ -180,12 +174,6 @@ EngCopyBits(SURFOBJ *psoDest,
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (psoDest != psoSource)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
}
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,20 +186,7 @@ IntEngCopyBits(
|
||||||
RECTL *prclDest,
|
RECTL *prclDest,
|
||||||
POINTL *ptlSource)
|
POINTL *ptlSource)
|
||||||
{
|
{
|
||||||
BOOL bResult;
|
return EngCopyBits(psoDest, psoSource, pco, pxlo, prclDest, ptlSource);
|
||||||
|
|
||||||
MouseSafetyOnDrawStart(psoSource, ptlSource->x, ptlSource->y,
|
|
||||||
(ptlSource->x + abs(prclDest->right - prclDest->left)),
|
|
||||||
(ptlSource->y + abs(prclDest->bottom - prclDest->top)));
|
|
||||||
|
|
||||||
MouseSafetyOnDrawStart(psoDest, prclDest->left, prclDest->top, prclDest->right, prclDest->bottom);
|
|
||||||
|
|
||||||
bResult = EngCopyBits(psoDest, psoSource, pco, pxlo, prclDest, ptlSource);
|
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
MouseSafetyOnDrawEnd(psoSource);
|
|
||||||
|
|
||||||
return bResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,264 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
|
||||||
|
PGRAPHICS_DEVICE gpVgaGraphicsDevice;
|
||||||
|
|
||||||
|
static PGRAPHICS_DEVICE gpGraphicsDeviceFirst = NULL;
|
||||||
|
static PGRAPHICS_DEVICE gpGraphicsDeviceLast = NULL;
|
||||||
|
static HSEMAPHORE ghsemGraphicsDeviceList;
|
||||||
|
static ULONG giDevNum = 1;
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitDeviceImpl()
|
||||||
|
{
|
||||||
|
ghsemGraphicsDeviceList = EngCreateSemaphore();
|
||||||
|
if (!ghsemGraphicsDeviceList)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PGRAPHICS_DEVICE
|
||||||
|
NTAPI
|
||||||
|
EngpRegisterGraphicsDevice(
|
||||||
|
PUNICODE_STRING pustrDeviceName,
|
||||||
|
PUNICODE_STRING pustrDiplayDrivers,
|
||||||
|
PUNICODE_STRING pustrDescription,
|
||||||
|
PDEVMODEW pdmDefault)
|
||||||
|
{
|
||||||
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
|
PDEVICE_OBJECT pDeviceObject;
|
||||||
|
PFILE_OBJECT pFileObject;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PWSTR pwsz;
|
||||||
|
ULONG i, cj, cModes = 0;
|
||||||
|
BOOL bEnable = TRUE;
|
||||||
|
PDEVMODEINFO pdminfo;
|
||||||
|
PDEVMODEW pdm, pdmEnd;
|
||||||
|
PLDEVOBJ pldev;
|
||||||
|
|
||||||
|
DPRINT1("EngpRegisterGraphicsDevice(%S)\n", pustrDeviceName->Buffer);
|
||||||
|
|
||||||
|
/* Allocate a GRAPHICS_DEVICE structure */
|
||||||
|
pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(GRAPHICS_DEVICE),
|
||||||
|
GDITAG_GDEVICE);
|
||||||
|
if (!pGraphicsDevice)
|
||||||
|
{
|
||||||
|
DPRINT1("ExAllocatePoolWithTag failed\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to open the driver */
|
||||||
|
Status = IoGetDeviceObjectPointer(pustrDeviceName,
|
||||||
|
FILE_READ_DATA | FILE_WRITE_DATA,
|
||||||
|
&pFileObject,
|
||||||
|
&pDeviceObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Could not open driver, 0x%lx\n", Status);
|
||||||
|
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable the device */
|
||||||
|
EngFileWrite(pFileObject, &bEnable, sizeof(BOOL), &cj);
|
||||||
|
|
||||||
|
/* Copy the device and file object pointers */
|
||||||
|
pGraphicsDevice->DeviceObject = pDeviceObject;
|
||||||
|
pGraphicsDevice->FileObject = pFileObject;
|
||||||
|
|
||||||
|
/* Copy device name */
|
||||||
|
wcsncpy(pGraphicsDevice->szNtDeviceName,
|
||||||
|
pustrDeviceName->Buffer,
|
||||||
|
sizeof(pGraphicsDevice->szNtDeviceName) / sizeof(WCHAR));
|
||||||
|
|
||||||
|
/* Create a win device name (FIXME: virtual devices!) */
|
||||||
|
swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\VIDEO%d", (CHAR)giDevNum);
|
||||||
|
|
||||||
|
/* Allocate a buffer for the strings */
|
||||||
|
cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR);
|
||||||
|
pwsz = ExAllocatePoolWithTag(PagedPool, cj, GDITAG_DRVSUP);
|
||||||
|
if (!pwsz)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not allocate string buffer\n");
|
||||||
|
ASSERT(FALSE); // FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy display driver names */
|
||||||
|
pGraphicsDevice->pDiplayDrivers = pwsz;
|
||||||
|
RtlCopyMemory(pGraphicsDevice->pDiplayDrivers,
|
||||||
|
pustrDiplayDrivers->Buffer,
|
||||||
|
pustrDiplayDrivers->Length);
|
||||||
|
|
||||||
|
/* Copy description */
|
||||||
|
pGraphicsDevice->pwszDescription = pwsz + pustrDiplayDrivers->Length / sizeof(WCHAR);
|
||||||
|
RtlCopyMemory(pGraphicsDevice->pwszDescription,
|
||||||
|
pustrDescription->Buffer,
|
||||||
|
pustrDescription->Length + sizeof(WCHAR));
|
||||||
|
|
||||||
|
/* Initialize the pdevmodeInfo list and default index */
|
||||||
|
pGraphicsDevice->pdevmodeInfo = NULL;
|
||||||
|
pGraphicsDevice->iDefaultMode = 0;
|
||||||
|
pGraphicsDevice->iCurrentMode = 0;
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
DPRINT1("trying driver: %ls\n", pwsz);
|
||||||
|
/* Try to load the display driver */
|
||||||
|
pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
|
||||||
|
if (!pldev)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not load driver: '%ls'\n", pwsz);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the mode list from the driver */
|
||||||
|
pdminfo = LDEVOBJ_pdmiGetModes(pldev, pDeviceObject);
|
||||||
|
if (!pdminfo)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not get mode list for '%ls'\n", pwsz);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Attach the mode info to the device */
|
||||||
|
pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
|
||||||
|
pGraphicsDevice->pdevmodeInfo = pdminfo;
|
||||||
|
|
||||||
|
/* Count DEVMODEs */
|
||||||
|
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
|
||||||
|
for (pdm = pdminfo->adevmode;
|
||||||
|
pdm + 1 <= pdmEnd;
|
||||||
|
pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
||||||
|
{
|
||||||
|
cModes++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: release the driver again until it's used?
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
|
||||||
|
{
|
||||||
|
DPRINT1("No devmodes\n");
|
||||||
|
ExFreePool(pGraphicsDevice);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate an index buffer */
|
||||||
|
pGraphicsDevice->cDevModes = cModes;
|
||||||
|
pGraphicsDevice->pDevModeList = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
cModes * sizeof(DEVMODEENTRY),
|
||||||
|
GDITAG_GDEVICE);
|
||||||
|
if (!pGraphicsDevice->pDevModeList)
|
||||||
|
{
|
||||||
|
DPRINT1("No devmode list\n");
|
||||||
|
ExFreePool(pGraphicsDevice);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
||||||
|
{
|
||||||
|
/* Compare with the default entry */
|
||||||
|
if (pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
|
||||||
|
pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
|
||||||
|
pdm->dmPelsHeight == pdmDefault->dmPelsHeight &&
|
||||||
|
pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
|
||||||
|
{
|
||||||
|
pGraphicsDevice->iDefaultMode = i;
|
||||||
|
pGraphicsDevice->iCurrentMode = i;
|
||||||
|
DPRINT1("Found default entry: %ld '%ls'\n", i, pdm->dmDeviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the entry */
|
||||||
|
pGraphicsDevice->pDevModeList[i].dwFlags = 0;
|
||||||
|
pGraphicsDevice->pDevModeList[i].pdm = pdm;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lock loader */
|
||||||
|
EngAcquireSemaphore(ghsemGraphicsDeviceList);
|
||||||
|
|
||||||
|
/* Insert the device into the global list */
|
||||||
|
pGraphicsDevice->pNextGraphicsDevice = gpGraphicsDeviceLast;
|
||||||
|
gpGraphicsDeviceLast = pGraphicsDevice;
|
||||||
|
if (!gpGraphicsDeviceFirst)
|
||||||
|
gpGraphicsDeviceFirst = pGraphicsDevice;
|
||||||
|
|
||||||
|
/* Increment device number */
|
||||||
|
giDevNum++;
|
||||||
|
|
||||||
|
/* Unlock loader */
|
||||||
|
EngReleaseSemaphore(ghsemGraphicsDeviceList);
|
||||||
|
DPRINT1("Prepared %ld modes for %ls\n", cModes, pGraphicsDevice->pwszDescription);
|
||||||
|
|
||||||
|
return pGraphicsDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PGRAPHICS_DEVICE
|
||||||
|
NTAPI
|
||||||
|
EngpFindGraphicsDevice(
|
||||||
|
PUNICODE_STRING pustrDevice,
|
||||||
|
ULONG iDevNum,
|
||||||
|
DWORD dwFlags)
|
||||||
|
{
|
||||||
|
UNICODE_STRING ustrCurrent;
|
||||||
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
/* Lock list */
|
||||||
|
EngAcquireSemaphore(ghsemGraphicsDeviceList);
|
||||||
|
|
||||||
|
if (pustrDevice)
|
||||||
|
{
|
||||||
|
/* Loop through the list of devices */
|
||||||
|
for (pGraphicsDevice = gpGraphicsDeviceFirst;
|
||||||
|
pGraphicsDevice;
|
||||||
|
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice)
|
||||||
|
{
|
||||||
|
/* Compare the device name */
|
||||||
|
RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
|
||||||
|
if (RtlEqualUnicodeString(&ustrCurrent, pustrDevice, FALSE))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Loop through the list of devices */
|
||||||
|
for (pGraphicsDevice = gpGraphicsDeviceFirst, i = 0;
|
||||||
|
pGraphicsDevice && i < iDevNum;
|
||||||
|
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice, i++);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlock list */
|
||||||
|
EngReleaseSemaphore(ghsemGraphicsDeviceList);
|
||||||
|
|
||||||
|
return pGraphicsDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
EngpFileIoRequest(
|
EngpFileIoRequest(
|
||||||
|
@ -39,7 +297,7 @@ EngpFileIoRequest(
|
||||||
/* Initialize an event */
|
/* Initialize an event */
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
/* Build IPR */
|
/* Build IRP */
|
||||||
liStartOffset.QuadPart = ullStartOffset;
|
liStartOffset.QuadPart = ullStartOffset;
|
||||||
pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
|
pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
|
||||||
pDeviceObject,
|
pDeviceObject,
|
||||||
|
@ -113,7 +371,7 @@ EngFileIoControl(
|
||||||
/* Initialize an event */
|
/* Initialize an event */
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
/* Build IO control IPR */
|
/* Build IO control IRP */
|
||||||
pIrp = IoBuildDeviceIoControlRequest(dwIoControlCode,
|
pIrp = IoBuildDeviceIoControlRequest(dwIoControlCode,
|
||||||
pDeviceObject,
|
pDeviceObject,
|
||||||
lpInBuffer,
|
lpInBuffer,
|
||||||
|
|
|
@ -18,8 +18,6 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
|
EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
|
||||||
{
|
{
|
||||||
HPALETTE hpal = NULL;
|
|
||||||
|
|
||||||
ASSERT(pebo);
|
ASSERT(pebo);
|
||||||
ASSERT(pbrush);
|
ASSERT(pbrush);
|
||||||
ASSERT(pdc);
|
ASSERT(pdc);
|
||||||
|
@ -35,14 +33,11 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
|
||||||
pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
|
pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
|
||||||
|
|
||||||
pebo->psurfTrg = pdc->dclevel.pSurface;
|
pebo->psurfTrg = pdc->dclevel.pSurface;
|
||||||
// ASSERT(pebo->psurfTrg); // FIXME: some dcs don't have a surface
|
ASSERT(pebo->psurfTrg);
|
||||||
|
ASSERT(pebo->psurfTrg->ppal);
|
||||||
|
|
||||||
if (pebo->psurfTrg)
|
pebo->ppalSurf = pebo->psurfTrg->ppal;
|
||||||
hpal = pebo->psurfTrg->hDIBPalette;
|
GDIOBJ_IncrementShareCount(&pebo->ppalSurf->BaseObject);
|
||||||
if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault;
|
|
||||||
pebo->ppalSurf = PALETTE_ShareLockPalette(hpal);
|
|
||||||
if (!pebo->ppalSurf)
|
|
||||||
pebo->ppalSurf = &gpalRGB;
|
|
||||||
|
|
||||||
if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
|
if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +75,12 @@ EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor)
|
||||||
pebo->ulRGBColor = crColor;
|
pebo->ulRGBColor = crColor;
|
||||||
|
|
||||||
/* Initialize an XLATEOBJ RGB -> surface */
|
/* Initialize an XLATEOBJ RGB -> surface */
|
||||||
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, pebo->ppalSurf, 0, 0, 0);
|
EXLATEOBJ_vInitialize(&exlo,
|
||||||
|
&gpalRGB,
|
||||||
|
pebo->ppalSurf,
|
||||||
|
pebo->crCurrentBack,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
/* Translate the brush color to the target format */
|
/* Translate the brush color to the target format */
|
||||||
iSolidColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
|
iSolidColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
|
||||||
|
@ -109,8 +109,7 @@ EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
|
||||||
pebo->BrushObject.pvRbrush = NULL;
|
pebo->BrushObject.pvRbrush = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pebo->ppalSurf != &gpalRGB)
|
PALETTE_ShareUnlockPalette(pebo->ppalSurf);
|
||||||
PALETTE_ShareUnlockPalette(pebo->ppalSurf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -145,7 +144,7 @@ EngRealizeBrush(
|
||||||
ULONG lWidth;
|
ULONG lWidth;
|
||||||
|
|
||||||
/* Calculate width in bytes of the realized brush */
|
/* Calculate width in bytes of the realized brush */
|
||||||
lWidth = DIB_GetDIBWidthBytes(psoPattern->sizlBitmap.cx,
|
lWidth = WIDTH_BYTES_ALIGN32(psoPattern->sizlBitmap.cx,
|
||||||
BitsPerFormat(psoDst->iBitmapFormat));
|
BitsPerFormat(psoDst->iBitmapFormat));
|
||||||
|
|
||||||
/* Allocate a bitmap */
|
/* Allocate a bitmap */
|
||||||
|
@ -192,12 +191,8 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver)
|
||||||
PPDEVOBJ ppdev = NULL;
|
PPDEVOBJ ppdev = NULL;
|
||||||
EXLATEOBJ exlo;
|
EXLATEOBJ exlo;
|
||||||
|
|
||||||
// FIXME: all EBRUSHOBJs need a surface, see EBRUSHOBJ_vInit
|
/* All EBRUSHOBJs have a surface, see EBRUSHOBJ_vInit */
|
||||||
if (!pebo->psurfTrg)
|
ASSERT(pebo->psurfTrg);
|
||||||
{
|
|
||||||
DPRINT1("Pattern brush has no target surface!\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ppdev = (PPDEVOBJ)pebo->psurfTrg->SurfObj.hdev;
|
ppdev = (PPDEVOBJ)pebo->psurfTrg->SurfObj.hdev;
|
||||||
|
|
||||||
|
@ -210,16 +205,18 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver)
|
||||||
|
|
||||||
psurfPattern = SURFACE_ShareLockSurface(pebo->pbrush->hbmPattern);
|
psurfPattern = SURFACE_ShareLockSurface(pebo->pbrush->hbmPattern);
|
||||||
ASSERT(psurfPattern);
|
ASSERT(psurfPattern);
|
||||||
|
ASSERT(psurfPattern->ppal);
|
||||||
|
|
||||||
/* FIXME: implement mask */
|
/* FIXME: implement mask */
|
||||||
psurfMask = NULL;
|
psurfMask = NULL;
|
||||||
|
|
||||||
/* Initialize XLATEOBJ for the brush */
|
/* Initialize XLATEOBJ for the brush */
|
||||||
EXLATEOBJ_vInitBrushXlate(&exlo,
|
EXLATEOBJ_vInitialize(&exlo,
|
||||||
pebo->pbrush,
|
psurfPattern->ppal,
|
||||||
pebo->psurfTrg,
|
pebo->psurfTrg->ppal,
|
||||||
pebo->crCurrentText,
|
0,
|
||||||
pebo->crCurrentBack);
|
pebo->crCurrentBack,
|
||||||
|
pebo->crCurrentText);
|
||||||
|
|
||||||
/* Create the realization */
|
/* Create the realization */
|
||||||
bResult = pfnRealzizeBrush(&pebo->BrushObject,
|
bResult = pfnRealzizeBrush(&pebo->BrushObject,
|
||||||
|
|
|
@ -56,7 +56,7 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
{
|
{
|
||||||
/* Driver needs to support DrvCopyBits, else we can't do anything */
|
/* Driver needs to support DrvCopyBits, else we can't do anything */
|
||||||
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||||
if (!(psurfDest->flHooks & HOOK_COPYBITS))
|
if (!(psurfDest->flags & HOOK_COPYBITS))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
/* Allocate a temporary bitmap */
|
/* Allocate a temporary bitmap */
|
||||||
BitmapSize.cx = DestRect->right - DestRect->left;
|
BitmapSize.cx = DestRect->right - DestRect->left;
|
||||||
BitmapSize.cy = DestRect->bottom - DestRect->top;
|
BitmapSize.cy = DestRect->bottom - DestRect->top;
|
||||||
Width = DIB_GetDIBWidthBytes(BitmapSize.cx, BitsPerFormat(psoDest->iBitmapFormat));
|
Width = WIDTH_BYTES_ALIGN32(BitmapSize.cx, BitsPerFormat(psoDest->iBitmapFormat));
|
||||||
EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
|
EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
|
||||||
psoDest->iBitmapFormat,
|
psoDest->iBitmapFormat,
|
||||||
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
|
||||||
|
@ -127,7 +127,6 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
&ClippedDestRect, &SrcPoint))
|
&ClippedDestRect, &SrcPoint))
|
||||||
{
|
{
|
||||||
EngDeleteClip(EnterLeave->TrivialClipObj);
|
EngDeleteClip(EnterLeave->TrivialClipObj);
|
||||||
EngFreeMem((*ppsoOutput)->pvBits);
|
|
||||||
EngUnlockSurface(*ppsoOutput);
|
EngUnlockSurface(*ppsoOutput);
|
||||||
EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
|
EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -149,7 +148,7 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
if (NULL != *ppsoOutput)
|
if (NULL != *ppsoOutput)
|
||||||
{
|
{
|
||||||
SURFACE* psurfOutput = CONTAINING_RECORD(*ppsoOutput, SURFACE, SurfObj);
|
SURFACE* psurfOutput = CONTAINING_RECORD(*ppsoOutput, SURFACE, SurfObj);
|
||||||
if (0 != (psurfOutput->flHooks & HOOK_SYNCHRONIZE))
|
if (0 != (psurfOutput->flags & HOOK_SYNCHRONIZE))
|
||||||
{
|
{
|
||||||
if (NULL != GDIDEVFUNCS(*ppsoOutput).SynchronizeSurface)
|
if (NULL != GDIDEVFUNCS(*ppsoOutput).SynchronizeSurface)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +218,6 @@ IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave)
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EngFreeMem(EnterLeave->OutputObj->pvBits);
|
|
||||||
EngUnlockSurface(EnterLeave->OutputObj);
|
EngUnlockSurface(EnterLeave->OutputObj);
|
||||||
EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
|
EngDeleteSurface((HSURF)EnterLeave->OutputBitmap);
|
||||||
EngDeleteClip(EnterLeave->TrivialClipObj);
|
EngDeleteClip(EnterLeave->TrivialClipObj);
|
||||||
|
|
|
@ -548,14 +548,7 @@ IntEngGradientFill(
|
||||||
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||||
ASSERT(psurf);
|
ASSERT(psurf);
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurf);
|
if(psurf->flags & HOOK_GRADIENTFILL)
|
||||||
MouseSafetyOnDrawStart(
|
|
||||||
psoDest,
|
|
||||||
pco->rclBounds.left,
|
|
||||||
pco->rclBounds.top,
|
|
||||||
pco->rclBounds.right,
|
|
||||||
pco->rclBounds.bottom);
|
|
||||||
if(psurf->flHooks & HOOK_GRADIENTFILL)
|
|
||||||
{
|
{
|
||||||
Ret = GDIDEVFUNCS(psoDest).GradientFill(
|
Ret = GDIDEVFUNCS(psoDest).GradientFill(
|
||||||
psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
|
psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
|
||||||
|
@ -566,8 +559,6 @@ IntEngGradientFill(
|
||||||
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents,
|
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents,
|
||||||
pptlDitherOrg, ulMode);
|
pptlDitherOrg, ulMode);
|
||||||
}
|
}
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
504
subsystems/win32/win32k/eng/ldevobj.c
Normal file
504
subsystems/win32/win32k/eng/ldevobj.c
Normal file
|
@ -0,0 +1,504 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: Support for logical devices
|
||||||
|
* FILE: subsystems/win32/win32k/eng/ldevobj.c
|
||||||
|
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <win32k.h>
|
||||||
|
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#ifndef RVA_TO_ADDR
|
||||||
|
#define RVA_TO_ADDR(Base,Rva) ((PVOID)(((ULONG_PTR)(Base)) + (Rva)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Globals *******************************************************************/
|
||||||
|
|
||||||
|
HSEMAPHORE ghsemLDEVList;
|
||||||
|
LDEVOBJ *gpldevHead = NULL;
|
||||||
|
LDEVOBJ *gpldevWin32k = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/** Private functions *********************************************************/
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitLDEVImpl()
|
||||||
|
{
|
||||||
|
/* Initialize the loader lock */
|
||||||
|
ghsemLDEVList = EngCreateSemaphore();
|
||||||
|
if (!ghsemLDEVList)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a LDEVOBJ for win32k */
|
||||||
|
gpldevWin32k = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(LDEVOBJ) +
|
||||||
|
sizeof(SYSTEM_GDI_DRIVER_INFORMATION),
|
||||||
|
GDITAG_LDEV);
|
||||||
|
if (!gpldevWin32k)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the LDEVOBJ for win32k */
|
||||||
|
gpldevWin32k->pldevNext = NULL;
|
||||||
|
gpldevWin32k->pldevPrev = NULL;
|
||||||
|
gpldevWin32k->ldevtype = LDEV_DEVICE_DISPLAY;
|
||||||
|
gpldevWin32k->cRefs = 1;
|
||||||
|
gpldevWin32k->ulDriverVersion = GDI_ENGINE_VERSION;
|
||||||
|
gpldevWin32k->pGdiDriverInfo = (PVOID)(gpldevWin32k + 1);
|
||||||
|
RtlInitUnicodeString(&gpldevWin32k->pGdiDriverInfo->DriverName,
|
||||||
|
L"\\SystemRoot\\System32\\win32k.sys");
|
||||||
|
gpldevWin32k->pGdiDriverInfo->ImageAddress = &__ImageBase;
|
||||||
|
gpldevWin32k->pGdiDriverInfo->SectionPointer = NULL;
|
||||||
|
gpldevWin32k->pGdiDriverInfo->EntryPoint = (PVOID)DriverEntry;
|
||||||
|
gpldevWin32k->pGdiDriverInfo->ExportSectionPointer = NULL;
|
||||||
|
gpldevWin32k->pGdiDriverInfo->ImageLength = 0; // FIXME;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_AllocLDEV(LDEVTYPE ldevtype)
|
||||||
|
{
|
||||||
|
PLDEVOBJ pldev;
|
||||||
|
|
||||||
|
/* Allocate the structure from paged pool */
|
||||||
|
pldev = ExAllocatePoolWithTag(PagedPool, sizeof(LDEVOBJ), GDITAG_LDEV);
|
||||||
|
if (!pldev)
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to allocate LDEVOBJ.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zero out the structure */
|
||||||
|
RtlZeroMemory(pldev, sizeof(LDEVOBJ));
|
||||||
|
|
||||||
|
/* Set the ldevtype */
|
||||||
|
pldev->ldevtype = ldevtype;
|
||||||
|
|
||||||
|
return pldev;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_vFreeLDEV(PLDEVOBJ pldev)
|
||||||
|
{
|
||||||
|
/* Make sure we don't have a driver loaded */
|
||||||
|
ASSERT(pldev && pldev->pGdiDriverInfo == NULL);
|
||||||
|
|
||||||
|
/* Free the memory */
|
||||||
|
ExFreePoolWithTag(pldev, TAG_LDEV);
|
||||||
|
}
|
||||||
|
|
||||||
|
PDEVMODEINFO
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_pdmiGetModes(
|
||||||
|
PLDEVOBJ pldev,
|
||||||
|
HANDLE hDriver)
|
||||||
|
{
|
||||||
|
ULONG cbSize, cbFull;
|
||||||
|
PDEVMODEINFO pdminfo;
|
||||||
|
|
||||||
|
DPRINT("LDEVOBJ_pdmiGetModes(%p, %p)\n", pldev, hDriver);
|
||||||
|
|
||||||
|
/* Call the driver to get the required size */
|
||||||
|
cbSize = pldev->pfn.GetModes(hDriver, 0, NULL);
|
||||||
|
if (!cbSize)
|
||||||
|
{
|
||||||
|
DPRINT1("DrvGetModes returned 0\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add space for the header */
|
||||||
|
cbFull = cbSize + FIELD_OFFSET(DEVMODEINFO, adevmode);
|
||||||
|
|
||||||
|
/* Allocate a buffer for the DEVMODE array */
|
||||||
|
pdminfo = ExAllocatePoolWithTag(PagedPool, cbFull, GDITAG_DEVMODE);
|
||||||
|
if (!pdminfo)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not allocate devmodeinfo\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdminfo->pldev = pldev;
|
||||||
|
pdminfo->cbdevmode = cbSize;
|
||||||
|
|
||||||
|
/* Call the driver again to fill the buffer */
|
||||||
|
cbSize = pldev->pfn.GetModes(hDriver, cbSize, pdminfo->adevmode);
|
||||||
|
if (!cbSize)
|
||||||
|
{
|
||||||
|
/* Could not get modes */
|
||||||
|
DPRINT1("returned size %ld(%ld)\n", cbSize, pdminfo->cbdevmode);
|
||||||
|
ExFreePool(pdminfo);
|
||||||
|
pdminfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pdminfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_bLoadImage(
|
||||||
|
IN PLDEVOBJ pldev,
|
||||||
|
PUNICODE_STRING pstrPathName)
|
||||||
|
{
|
||||||
|
PSYSTEM_GDI_DRIVER_INFORMATION pDriverInfo;
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG cbSize;
|
||||||
|
|
||||||
|
/* Make sure no image is loaded yet */
|
||||||
|
ASSERT(pldev && pldev->pGdiDriverInfo == NULL);
|
||||||
|
|
||||||
|
/* Allocate a SYSTEM_GDI_DRIVER_INFORMATION structure */
|
||||||
|
cbSize = sizeof(SYSTEM_GDI_DRIVER_INFORMATION) + pstrPathName->Length;
|
||||||
|
pDriverInfo = ExAllocatePoolWithTag(PagedPool, cbSize, GDITAG_LDEV);
|
||||||
|
if (!pDriverInfo)
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to allocate SYSTEM_GDI_DRIVER_INFORMATION\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the UNICODE_STRING and copy the driver name */
|
||||||
|
RtlInitEmptyUnicodeString(&pDriverInfo->DriverName,
|
||||||
|
(PWSTR)(pDriverInfo + 1),
|
||||||
|
pstrPathName->Length);
|
||||||
|
RtlCopyUnicodeString(&pDriverInfo->DriverName, pstrPathName);
|
||||||
|
|
||||||
|
/* Try to load the driver */
|
||||||
|
Status = ZwSetSystemInformation(SystemLoadGdiDriverInformation,
|
||||||
|
pDriverInfo,
|
||||||
|
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to load a GDI driver: '%S', Status = 0x%lx\n",
|
||||||
|
pstrPathName->Buffer, Status);
|
||||||
|
|
||||||
|
/* Free the allocated memory */
|
||||||
|
ExFreePoolWithTag(pDriverInfo, TAG_LDEV);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the driver info */
|
||||||
|
pldev->pGdiDriverInfo = pDriverInfo;
|
||||||
|
|
||||||
|
/* Return success. */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_vUnloadImage(
|
||||||
|
IN PLDEVOBJ pldev)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Make sure we have a driver info */
|
||||||
|
ASSERT(pldev && pldev->pGdiDriverInfo != NULL);
|
||||||
|
|
||||||
|
/* Check if we have loaded a driver */
|
||||||
|
if (pldev->pfn.DisableDriver)
|
||||||
|
{
|
||||||
|
/* Call the unload function */
|
||||||
|
pldev->pfn.DisableDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unload the driver */
|
||||||
|
Status = ZwSetSystemInformation(SystemUnloadGdiDriverInformation,
|
||||||
|
&pldev->pGdiDriverInfo->ImageAddress,
|
||||||
|
sizeof(HANDLE));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to unload the driver, this is bad.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free the driver info structure */
|
||||||
|
ExFreePoolWithTag(pldev->pGdiDriverInfo, GDITAG_LDEV);
|
||||||
|
pldev->pGdiDriverInfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_bLoadDriver(
|
||||||
|
IN PLDEVOBJ pldev)
|
||||||
|
{
|
||||||
|
PFN_DrvEnableDriver pfnEnableDriver;
|
||||||
|
DRVENABLEDATA ded;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
/* Make sure we have a driver info */
|
||||||
|
ASSERT(pldev && pldev->pGdiDriverInfo != NULL);
|
||||||
|
|
||||||
|
/* Call the drivers DrvEnableDriver function */
|
||||||
|
RtlZeroMemory(&ded, sizeof(ded));
|
||||||
|
pfnEnableDriver = pldev->pGdiDriverInfo->EntryPoint;
|
||||||
|
if (!pfnEnableDriver(GDI_ENGINE_VERSION, sizeof(ded), &ded))
|
||||||
|
{
|
||||||
|
DPRINT1("DrvEnableDriver failed\n");
|
||||||
|
|
||||||
|
/* Unload the image. */
|
||||||
|
LDEVOBJ_vUnloadImage(pldev);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy the returned driver version */
|
||||||
|
pldev->ulDriverVersion = ded.iDriverVersion;
|
||||||
|
|
||||||
|
/* Fill the driver function array */
|
||||||
|
for (i = 0; i < ded.c; i++)
|
||||||
|
{
|
||||||
|
pldev->apfn[ded.pdrvfn[i].iFunc] = ded.pdrvfn[i].pfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success. */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_pvFindImageProcAddress(
|
||||||
|
IN PLDEVOBJ pldev,
|
||||||
|
IN LPSTR pszProcName)
|
||||||
|
{
|
||||||
|
PVOID pvImageBase;
|
||||||
|
PIMAGE_EXPORT_DIRECTORY pExportDir;
|
||||||
|
PVOID pvProcAdress = NULL;
|
||||||
|
PUSHORT pOrdinals;
|
||||||
|
PULONG pNames, pAddresses;
|
||||||
|
ULONG i, cbSize;
|
||||||
|
|
||||||
|
/* Make sure we have a driver info */
|
||||||
|
ASSERT(pldev && pldev->pGdiDriverInfo != NULL);
|
||||||
|
|
||||||
|
/* Get the pointer to the export directory */
|
||||||
|
pvImageBase = pldev->pGdiDriverInfo->ImageAddress;
|
||||||
|
pExportDir = RtlImageDirectoryEntryToData(pvImageBase,
|
||||||
|
TRUE,
|
||||||
|
IMAGE_DIRECTORY_ENTRY_EXPORT,
|
||||||
|
&cbSize);
|
||||||
|
if (!pExportDir)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get pointers to some tables */
|
||||||
|
pNames = RVA_TO_ADDR(pvImageBase, pExportDir->AddressOfNames);
|
||||||
|
pOrdinals = RVA_TO_ADDR(pvImageBase, pExportDir->AddressOfNameOrdinals);
|
||||||
|
pAddresses = RVA_TO_ADDR(pvImageBase, pExportDir->AddressOfFunctions);
|
||||||
|
|
||||||
|
/* Loop the export table */
|
||||||
|
for (i = 0; i < pExportDir->NumberOfNames; i++)
|
||||||
|
{
|
||||||
|
/* Compare the name */
|
||||||
|
if (_stricmp(pszProcName, RVA_TO_ADDR(pvImageBase, pNames[i])) == 0)
|
||||||
|
{
|
||||||
|
/* Found! Calculate the procedure address */
|
||||||
|
pvProcAdress = RVA_TO_ADDR(pvImageBase, pAddresses[pOrdinals[i]]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the address */
|
||||||
|
return pvProcAdress;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
EngLoadImageEx(
|
||||||
|
LPWSTR pwszDriverName,
|
||||||
|
ULONG ldevtype)
|
||||||
|
{
|
||||||
|
WCHAR acwBuffer[MAX_PATH];
|
||||||
|
PLDEVOBJ pldev;
|
||||||
|
UNICODE_STRING strDriverName;
|
||||||
|
ULONG cwcLength;
|
||||||
|
LPWSTR pwsz;
|
||||||
|
|
||||||
|
DPRINT("EngLoadImageEx(%ls, %ld)\n", pwszDriverName, ldevtype);
|
||||||
|
ASSERT(pwszDriverName);
|
||||||
|
|
||||||
|
/* Initialize buffer for the the driver name */
|
||||||
|
RtlInitEmptyUnicodeString(&strDriverName, acwBuffer, sizeof(acwBuffer));
|
||||||
|
|
||||||
|
/* Start path with systemroot */
|
||||||
|
RtlAppendUnicodeToString(&strDriverName, L"\\SystemRoot\\System32\\");
|
||||||
|
|
||||||
|
/* Get Length of given string */
|
||||||
|
cwcLength = wcslen(pwszDriverName);
|
||||||
|
|
||||||
|
/* Check if we have a system32 path given */
|
||||||
|
pwsz = pwszDriverName + cwcLength;
|
||||||
|
while (pwsz > pwszDriverName)
|
||||||
|
{
|
||||||
|
if (_wcsnicmp(pwsz, L"\\system32\\", 10) == 0)
|
||||||
|
{
|
||||||
|
/* Driver name starts after system32 */
|
||||||
|
pwsz += 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pwsz--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Append the driver name */
|
||||||
|
RtlAppendUnicodeToString(&strDriverName, pwsz);
|
||||||
|
|
||||||
|
/* MSDN says "The driver must include this suffix in the pwszDriver string."
|
||||||
|
But in fact it's optional. */
|
||||||
|
if (_wcsnicmp(pwszDriverName + cwcLength - 4, L".dll", 4) != 0)
|
||||||
|
{
|
||||||
|
/* Append the .dll suffix */
|
||||||
|
RtlAppendUnicodeToString(&strDriverName, L".dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lock loader */
|
||||||
|
EngAcquireSemaphore(ghsemLDEVList);
|
||||||
|
|
||||||
|
/* Search the List of LDEVS for the driver name */
|
||||||
|
for (pldev = gpldevHead; pldev != NULL; pldev = pldev->pldevNext)
|
||||||
|
{
|
||||||
|
/* Check if the ldev is associated with a file */
|
||||||
|
if (pldev->pGdiDriverInfo)
|
||||||
|
{
|
||||||
|
/* Check for match (case insensative) */
|
||||||
|
if (RtlEqualUnicodeString(&pldev->pGdiDriverInfo->DriverName, &strDriverName, 1))
|
||||||
|
{
|
||||||
|
/* Image found in LDEV list */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Did we find one? */
|
||||||
|
if (!pldev)
|
||||||
|
{
|
||||||
|
/* No, allocate a new LDEVOBJ */
|
||||||
|
pldev = LDEVOBJ_AllocLDEV(ldevtype);
|
||||||
|
if (!pldev)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not allocate LDEV\n");
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load the image */
|
||||||
|
if (!LDEVOBJ_bLoadImage(pldev, &strDriverName))
|
||||||
|
{
|
||||||
|
LDEVOBJ_vFreeLDEV(pldev);
|
||||||
|
pldev = NULL;
|
||||||
|
DPRINT1("LDEVOBJ_bLoadImage failed\n");
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Shall we load a driver? */
|
||||||
|
if (ldevtype != LDEV_IMAGE)
|
||||||
|
{
|
||||||
|
/* Load the driver */
|
||||||
|
if (!LDEVOBJ_bLoadDriver(pldev))
|
||||||
|
{
|
||||||
|
DPRINT1("LDEVOBJ_bLoadDriver failed\n");
|
||||||
|
LDEVOBJ_vFreeLDEV(pldev);
|
||||||
|
pldev = NULL;
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert the LDEV into the global list */
|
||||||
|
pldev->pldevPrev = NULL;
|
||||||
|
pldev->pldevNext = gpldevHead;
|
||||||
|
gpldevHead = pldev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Increase ref count */
|
||||||
|
pldev->cRefs++;
|
||||||
|
|
||||||
|
leave:
|
||||||
|
/* Unlock loader */
|
||||||
|
EngReleaseSemaphore(ghsemLDEVList);
|
||||||
|
|
||||||
|
DPRINT("EngLoadImageEx returning %p\n", pldev);
|
||||||
|
|
||||||
|
return pldev;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Exported functions ********************************************************/
|
||||||
|
|
||||||
|
HANDLE
|
||||||
|
APIENTRY
|
||||||
|
EngLoadImage(
|
||||||
|
LPWSTR pwszDriverName)
|
||||||
|
{
|
||||||
|
return (HANDLE)EngLoadImageEx(pwszDriverName, LDEV_IMAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
APIENTRY
|
||||||
|
EngUnloadImage(
|
||||||
|
IN HANDLE hModule)
|
||||||
|
{
|
||||||
|
PLDEVOBJ pldev = (PLDEVOBJ)hModule;
|
||||||
|
|
||||||
|
/* Make sure the LDEV is in the list */
|
||||||
|
ASSERT(pldev->pldevPrev || pldev->pldevNext);
|
||||||
|
|
||||||
|
/* Lock loader */
|
||||||
|
EngAcquireSemaphore(ghsemLDEVList);
|
||||||
|
|
||||||
|
/* Decrement reference count */
|
||||||
|
pldev->cRefs--;
|
||||||
|
|
||||||
|
/* No more references left? */
|
||||||
|
if (pldev->cRefs == 0)
|
||||||
|
{
|
||||||
|
/* Remove ldev from the list */
|
||||||
|
if (pldev->pldevPrev)
|
||||||
|
pldev->pldevPrev->pldevNext = pldev->pldevNext;
|
||||||
|
if (pldev->pldevNext)
|
||||||
|
pldev->pldevNext->pldevPrev = pldev->pldevPrev;
|
||||||
|
|
||||||
|
/* Unload the image */
|
||||||
|
LDEVOBJ_vUnloadImage(pldev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlock loader */
|
||||||
|
EngReleaseSemaphore(ghsemLDEVList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
APIENTRY
|
||||||
|
EngFindImageProcAddress(
|
||||||
|
IN HANDLE hModule,
|
||||||
|
IN LPSTR lpProcName)
|
||||||
|
{
|
||||||
|
PLDEVOBJ pldev = (PLDEVOBJ)hModule;
|
||||||
|
|
||||||
|
ASSERT(gpldevWin32k != NULL);
|
||||||
|
|
||||||
|
/* Check if win32k is requested */
|
||||||
|
if (!pldev)
|
||||||
|
{
|
||||||
|
pldev = gpldevWin32k;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the drivers entry point is requested */
|
||||||
|
if (_strnicmp(lpProcName, "DrvEnableDriver", 15) == 0)
|
||||||
|
{
|
||||||
|
return pldev->pGdiDriverInfo->EntryPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to find the address */
|
||||||
|
return LDEVOBJ_pvFindImageProcAddress(pldev, lpProcName);
|
||||||
|
}
|
||||||
|
|
|
@ -565,10 +565,7 @@ IntEngLineTo(SURFOBJ *psoDest,
|
||||||
if (b.left == b.right) b.right++;
|
if (b.left == b.right) b.right++;
|
||||||
if (b.top == b.bottom) b.bottom++;
|
if (b.top == b.bottom) b.bottom++;
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
if (psurfDest->flags & HOOK_LINETO)
|
||||||
MouseSafetyOnDrawStart(psoDest, x1, y1, x2, y2);
|
|
||||||
|
|
||||||
if (psurfDest->flHooks & HOOK_LINETO)
|
|
||||||
{
|
{
|
||||||
/* Call the driver's DrvLineTo */
|
/* Call the driver's DrvLineTo */
|
||||||
ret = GDIDEVFUNCS(psoDest).LineTo(
|
ret = GDIDEVFUNCS(psoDest).LineTo(
|
||||||
|
@ -576,7 +573,7 @@ IntEngLineTo(SURFOBJ *psoDest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (! ret && (psurfDest->flHooks & HOOK_STROKEPATH))
|
if (! ret && (psurfDest->flags & HOOK_STROKEPATH))
|
||||||
{
|
{
|
||||||
/* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */
|
/* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */
|
||||||
}
|
}
|
||||||
|
@ -587,9 +584,6 @@ IntEngLineTo(SURFOBJ *psoDest,
|
||||||
ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
|
ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Functions for mapping files and sections
|
* PURPOSE: Functions for mapping files and sections
|
||||||
* FILE: subsys/win32k/eng/device.c
|
* FILE: subsys/win32k/eng/device.c
|
||||||
* PROGRAMER:
|
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <win32k.h>
|
#include <win32k.h>
|
||||||
|
@ -11,12 +11,348 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
// HACK!!!
|
||||||
|
#define MmMapViewInSessionSpace MmMapViewInSystemSpace
|
||||||
|
#define MmUnmapViewInSessionSpace MmUnmapViewInSystemSpace
|
||||||
|
|
||||||
|
typedef struct _ENGSECTION
|
||||||
|
{
|
||||||
|
PVOID pvSectionObject;
|
||||||
|
PVOID pvMappedBase;
|
||||||
|
SIZE_T cjViewSize;
|
||||||
|
ULONG ulTag;
|
||||||
|
} ENGSECTION, *PENGSECTION;
|
||||||
|
|
||||||
|
typedef struct _FILEVIEW
|
||||||
|
{
|
||||||
|
LARGE_INTEGER LastWriteTime;
|
||||||
|
PVOID pvKView;
|
||||||
|
PVOID pvViewFD;
|
||||||
|
SIZE_T cjView;
|
||||||
|
PVOID pSection;
|
||||||
|
} FILEVIEW, *PFILEVIEW;
|
||||||
|
|
||||||
|
typedef struct _FONTFILEVIEW
|
||||||
|
{
|
||||||
|
FILEVIEW;
|
||||||
|
DWORD reserved[2];
|
||||||
|
PWSTR pwszPath;
|
||||||
|
SIZE_T ulRegionSize;
|
||||||
|
ULONG cKRefCount;
|
||||||
|
ULONG cRefCountFD;
|
||||||
|
PVOID pvSpoolerBase;
|
||||||
|
DWORD dwSpoolerPid;
|
||||||
|
} FONTFILEVIEW, *PFONTFILEVIEW;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
FVF_SYSTEMROOT = 1,
|
||||||
|
FVF_READONLY = 2,
|
||||||
|
FVF_FONTFILE = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
HANDLE ghSystem32Directory;
|
||||||
|
HANDLE ghRootDirectory;
|
||||||
|
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
EngCreateSection(
|
||||||
|
IN ULONG fl,
|
||||||
|
IN SIZE_T cjSize,
|
||||||
|
IN ULONG ulTag)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PENGSECTION pSection;
|
||||||
|
PVOID pvSectionObject;
|
||||||
|
LARGE_INTEGER liSize;
|
||||||
|
|
||||||
|
/* Allocate a section object */
|
||||||
|
pSection = EngAllocMem(0, sizeof(ENGSECTION), 'stsU');
|
||||||
|
if (!pSection) return NULL;
|
||||||
|
|
||||||
|
liSize.QuadPart = cjSize;
|
||||||
|
Status = MmCreateSection(&pvSectionObject,
|
||||||
|
SECTION_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
&liSize,
|
||||||
|
PAGE_READWRITE,
|
||||||
|
SEC_COMMIT,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create a section Status=0x%x\n", Status);
|
||||||
|
EngFreeMem(pSection);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the fields of the section */
|
||||||
|
pSection->ulTag = ulTag;
|
||||||
|
pSection->pvSectionObject = pvSectionObject;
|
||||||
|
pSection->pvMappedBase = NULL;
|
||||||
|
pSection->cjViewSize = cjSize;
|
||||||
|
|
||||||
|
return pSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
APIENTRY
|
||||||
|
EngMapSection(
|
||||||
|
IN PVOID pvSection,
|
||||||
|
IN BOOL bMap,
|
||||||
|
IN HANDLE hProcess,
|
||||||
|
OUT PVOID* pvBaseAddress)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PENGSECTION pSection = pvSection;
|
||||||
|
PEPROCESS pepProcess;
|
||||||
|
|
||||||
|
/* Get a pointer to the process */
|
||||||
|
Status = ObReferenceObjectByHandle(hProcess,
|
||||||
|
PROCESS_VM_OPERATION,
|
||||||
|
NULL,
|
||||||
|
KernelMode,
|
||||||
|
(PVOID*)&pepProcess,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Could not access process %p, Status=0x%lx\n", hProcess, Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bMap)
|
||||||
|
{
|
||||||
|
/* Make sure the section isn't already mapped */
|
||||||
|
ASSERT(pSection->pvMappedBase == NULL);
|
||||||
|
|
||||||
|
/* Map the section into the process address space */
|
||||||
|
Status = MmMapViewOfSection(pSection->pvSectionObject,
|
||||||
|
pepProcess,
|
||||||
|
&pSection->pvMappedBase,
|
||||||
|
0,
|
||||||
|
pSection->cjViewSize,
|
||||||
|
NULL,
|
||||||
|
&pSection->cjViewSize,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
PAGE_READWRITE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to map a section Status=0x%x\n", Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Make sure the section is mapped */
|
||||||
|
ASSERT(pSection->pvMappedBase);
|
||||||
|
|
||||||
|
/* Unmap the section from the process address space */
|
||||||
|
Status = MmUnmapViewOfSection(pepProcess, pSection->pvMappedBase);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
pSection->pvMappedBase = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to unmap a section @ &p Status=0x%x\n",
|
||||||
|
pSection->pvMappedBase, Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dereference the process */
|
||||||
|
ObDereferenceObject(pepProcess);
|
||||||
|
|
||||||
|
/* Set the new mapping base and return bool status */
|
||||||
|
*pvBaseAddress = pSection->pvMappedBase;
|
||||||
|
return NT_SUCCESS(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
APIENTRY
|
||||||
|
EngFreeSectionMem(
|
||||||
|
IN PVOID pvSection OPTIONAL,
|
||||||
|
IN PVOID pvMappedBase OPTIONAL)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PENGSECTION pSection = pvSection;
|
||||||
|
BOOL bResult = TRUE;
|
||||||
|
|
||||||
|
/* Did the caller give us a mapping base? */
|
||||||
|
if (pvMappedBase)
|
||||||
|
{
|
||||||
|
Status = MmUnmapViewInSessionSpace(pvMappedBase);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MmUnmapViewInSessionSpace failed: 0x%lx\n", Status);
|
||||||
|
bResult = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if we should free the section as well */
|
||||||
|
if (pSection)
|
||||||
|
{
|
||||||
|
/* Dereference the kernel section */
|
||||||
|
ObDereferenceObject(pSection->pvSectionObject);
|
||||||
|
|
||||||
|
/* Finally free the section memory itself */
|
||||||
|
EngFreeMem(pSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
APIENTRY
|
||||||
|
EngAllocSectionMem(
|
||||||
|
OUT PVOID *ppvSection,
|
||||||
|
IN ULONG fl,
|
||||||
|
IN SIZE_T cjSize,
|
||||||
|
IN ULONG ulTag)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PENGSECTION pSection;
|
||||||
|
|
||||||
|
/* Check parameter */
|
||||||
|
if (cjSize == 0) return NULL;
|
||||||
|
|
||||||
|
/* Allocate a section object */
|
||||||
|
pSection = EngCreateSection(fl, cjSize, ulTag);
|
||||||
|
if (!pSection)
|
||||||
|
{
|
||||||
|
*ppvSection = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Map the section in session space */
|
||||||
|
Status = MmMapViewInSessionSpace(pSection->pvSectionObject,
|
||||||
|
&pSection->pvMappedBase,
|
||||||
|
&pSection->cjViewSize);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to map a section Status=0x%x\n", Status);
|
||||||
|
*ppvSection = NULL;
|
||||||
|
EngFreeSectionMem(pSection, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fl & FL_ZERO_MEMORY)
|
||||||
|
{
|
||||||
|
RtlZeroMemory(pSection->pvMappedBase, cjSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set section pointer and return base address */
|
||||||
|
*ppvSection = pSection;
|
||||||
|
return pSection->pvMappedBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PFILEVIEW
|
||||||
|
NTAPI
|
||||||
|
EngLoadModuleEx(
|
||||||
|
LPWSTR pwsz,
|
||||||
|
ULONG cjSizeOfModule,
|
||||||
|
FLONG fl)
|
||||||
|
{
|
||||||
|
PFILEVIEW pFileView = NULL;
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
HANDLE hRootDir;
|
||||||
|
UNICODE_STRING ustrFileName;
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
FILE_BASIC_INFORMATION FileInformation;
|
||||||
|
HANDLE hFile;
|
||||||
|
NTSTATUS Status;
|
||||||
|
LARGE_INTEGER liSize;
|
||||||
|
|
||||||
|
if (fl & FVF_FONTFILE)
|
||||||
|
{
|
||||||
|
pFileView = EngAllocMem(0, sizeof(FONTFILEVIEW), 'vffG');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pFileView = EngAllocMem(0, sizeof(FILEVIEW), 'liFg');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for success */
|
||||||
|
if (!pFileView) return NULL;
|
||||||
|
|
||||||
|
/* Check if the file is relative to system32 */
|
||||||
|
if (fl & FVF_SYSTEMROOT)
|
||||||
|
{
|
||||||
|
hRootDir = ghSystem32Directory;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hRootDir = ghRootDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize unicode string and object attributes */
|
||||||
|
RtlInitUnicodeString(&ustrFileName, pwsz);
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&ustrFileName,
|
||||||
|
OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE,
|
||||||
|
hRootDir,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Now open the file */
|
||||||
|
Status = ZwCreateFile(&hFile,
|
||||||
|
FILE_READ_DATA,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&IoStatusBlock,
|
||||||
|
NULL,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
0,
|
||||||
|
FILE_OPEN,
|
||||||
|
FILE_NON_DIRECTORY_FILE,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
|
||||||
|
Status = ZwQueryInformationFile(hFile,
|
||||||
|
&IoStatusBlock,
|
||||||
|
&FileInformation,
|
||||||
|
sizeof(FILE_BASIC_INFORMATION),
|
||||||
|
FileBasicInformation);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
pFileView->LastWriteTime = FileInformation.LastWriteTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a section from the file */
|
||||||
|
liSize.QuadPart = cjSizeOfModule;
|
||||||
|
Status = MmCreateSection(&pFileView->pSection,
|
||||||
|
SECTION_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
cjSizeOfModule ? &liSize : NULL,
|
||||||
|
fl & FVF_READONLY ? PAGE_EXECUTE_READ : PAGE_EXECUTE_READWRITE,
|
||||||
|
SEC_COMMIT,
|
||||||
|
hFile,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* Close the file handle */
|
||||||
|
ZwClose(hFile);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create a section Status=0x%x\n", Status);
|
||||||
|
EngFreeMem(pFileView);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pFileView->pvKView = NULL;
|
||||||
|
pFileView->pvViewFD = NULL;
|
||||||
|
pFileView->cjView = 0;
|
||||||
|
|
||||||
|
return pFileView;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
APIENTRY
|
APIENTRY
|
||||||
EngLoadModule(LPWSTR pwsz)
|
EngLoadModule(LPWSTR pwsz)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
/* Forward to EngLoadModuleEx */
|
||||||
return NULL;
|
return (HANDLE)EngLoadModuleEx(pwsz, 0, FVF_READONLY | FVF_SYSTEMROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
|
@ -25,9 +361,8 @@ EngLoadModuleForWrite(
|
||||||
IN LPWSTR pwsz,
|
IN LPWSTR pwsz,
|
||||||
IN ULONG cjSizeOfModule)
|
IN ULONG cjSizeOfModule)
|
||||||
{
|
{
|
||||||
// www.osr.com/ddk/graphics/gdifncs_98rr.htm
|
/* Forward to EngLoadModuleEx */
|
||||||
UNIMPLEMENTED;
|
return (HANDLE)EngLoadModuleEx(pwsz, cjSizeOfModule, FVF_SYSTEMROOT);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
|
@ -36,17 +371,46 @@ EngMapModule(
|
||||||
IN HANDLE h,
|
IN HANDLE h,
|
||||||
OUT PULONG pulSize)
|
OUT PULONG pulSize)
|
||||||
{
|
{
|
||||||
// www.osr.com/ddk/graphics/gdifncs_9b1j.htm
|
PFILEVIEW pFileView = (PFILEVIEW)h;
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
return NULL;
|
|
||||||
|
pFileView->cjView = 0;
|
||||||
|
|
||||||
|
/* Map the section in session space */
|
||||||
|
Status = MmMapViewInSessionSpace(pFileView->pSection,
|
||||||
|
&pFileView->pvKView,
|
||||||
|
&pFileView->cjView);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to map a section Status=0x%x\n", Status);
|
||||||
|
*pulSize = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pulSize = pFileView->cjView;
|
||||||
|
return pFileView->pvKView;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
APIENTRY
|
APIENTRY
|
||||||
EngFreeModule (IN HANDLE h)
|
EngFreeModule(IN HANDLE h)
|
||||||
{
|
{
|
||||||
// www.osr.com/ddk/graphics/gdifncs_9fzb.htm
|
PFILEVIEW pFileView = (PFILEVIEW)h;
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Unmap the section */
|
||||||
|
Status = MmUnmapViewInSessionSpace(pFileView->pvKView);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("MmUnmapViewInSessionSpace failed: 0x%lx\n", Status);
|
||||||
|
ASSERT(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dereference the section */
|
||||||
|
ObDereferenceObject(pFileView->pSection);
|
||||||
|
|
||||||
|
/* Free the file view memory */
|
||||||
|
EngFreeMem(pFileView);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
|
@ -56,8 +420,28 @@ EngMapFile(
|
||||||
IN ULONG cjSize,
|
IN ULONG cjSize,
|
||||||
OUT ULONG_PTR *piFile)
|
OUT ULONG_PTR *piFile)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
HANDLE hModule;
|
||||||
return NULL;
|
PVOID pvBase;
|
||||||
|
|
||||||
|
/* Load the file */
|
||||||
|
hModule = EngLoadModuleEx(pwsz, 0, 0);
|
||||||
|
if (!hModule)
|
||||||
|
{
|
||||||
|
*piFile = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Map the file */
|
||||||
|
pvBase = EngMapModule(hModule, &cjSize);
|
||||||
|
if (!pvBase)
|
||||||
|
{
|
||||||
|
EngFreeModule(hModule);
|
||||||
|
hModule = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set iFile and return mapped base */
|
||||||
|
*piFile = (ULONG_PTR)hModule;
|
||||||
|
return pvBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
@ -65,8 +449,11 @@ APIENTRY
|
||||||
EngUnmapFile(
|
EngUnmapFile(
|
||||||
IN ULONG_PTR iFile)
|
IN ULONG_PTR iFile)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
HANDLE hModule = (HANDLE)iFile;
|
||||||
return FALSE;
|
|
||||||
|
EngFreeModule(hModule);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,36 +497,3 @@ EngUnmapFontFile(
|
||||||
// www.osr.com/ddk/graphics/gdifncs_09wn.htm
|
// www.osr.com/ddk/graphics/gdifncs_09wn.htm
|
||||||
EngUnmapFontFileFD(iFile);
|
EngUnmapFontFileFD(iFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
APIENTRY
|
|
||||||
EngMapSection(IN PVOID Section,
|
|
||||||
IN BOOLEAN Map,
|
|
||||||
IN HANDLE Process,
|
|
||||||
IN PVOID* BaseAddress)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PVOID
|
|
||||||
APIENTRY
|
|
||||||
EngAllocSectionMem(IN PVOID SectionObject,
|
|
||||||
IN ULONG Flags,
|
|
||||||
IN SIZE_T MemSize,
|
|
||||||
IN ULONG Tag)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
APIENTRY
|
|
||||||
EngFreeSectionMem(IN PVOID SectionObject OPTIONAL,
|
|
||||||
IN PVOID MappedBase)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ EngAllocUserMem(SIZE_T cj, ULONG Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */
|
/* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */
|
||||||
|
//hSecure = EngSecureMem(NewMem, cj);
|
||||||
|
|
||||||
return NewMem;
|
return NewMem;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +167,7 @@ HackUnsecureVirtualMemory(
|
||||||
HANDLE APIENTRY
|
HANDLE APIENTRY
|
||||||
EngSecureMem(PVOID Address, ULONG Length)
|
EngSecureMem(PVOID Address, ULONG Length)
|
||||||
{
|
{
|
||||||
|
return (HANDLE)-1; // HACK!!!
|
||||||
return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE);
|
return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +177,7 @@ EngSecureMem(PVOID Address, ULONG Length)
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
EngUnsecureMem(HANDLE Mem)
|
EngUnsecureMem(HANDLE Mem)
|
||||||
{
|
{
|
||||||
|
if (Mem == (HANDLE)-1) return; // HACK!!!
|
||||||
MmUnsecureVirtualMemory((PVOID) Mem);
|
MmUnsecureVirtualMemory((PVOID) Mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,23 +37,17 @@ EngSetPointerTag(
|
||||||
*/
|
*/
|
||||||
INT INTERNAL_CALL
|
INT INTERNAL_CALL
|
||||||
MouseSafetyOnDrawStart(
|
MouseSafetyOnDrawStart(
|
||||||
SURFOBJ *pso,
|
PPDEVOBJ ppdev,
|
||||||
LONG HazardX1,
|
LONG HazardX1,
|
||||||
LONG HazardY1,
|
LONG HazardY1,
|
||||||
LONG HazardX2,
|
LONG HazardX2,
|
||||||
LONG HazardY2)
|
LONG HazardY2)
|
||||||
{
|
{
|
||||||
LONG tmp;
|
LONG tmp;
|
||||||
PDEVOBJ *ppdev;
|
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(pso != NULL);
|
ASSERT(ppdev != NULL);
|
||||||
|
ASSERT(ppdev->pSurface != NULL);
|
||||||
ppdev = GDIDEV(pso);
|
|
||||||
if (ppdev == NULL)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
|
@ -83,12 +77,12 @@ MouseSafetyOnDrawStart(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgp->Exclude.right >= HazardX1
|
if (pgp->Exclude.right >= HazardX1
|
||||||
&& pgp->Exclude.left <= HazardX2
|
&& pgp->Exclude.left <= HazardX2
|
||||||
&& pgp->Exclude.bottom >= HazardY1
|
&& pgp->Exclude.bottom >= HazardY1
|
||||||
&& pgp->Exclude.top <= HazardY2)
|
&& pgp->Exclude.top <= HazardY2)
|
||||||
{
|
{
|
||||||
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
|
ppdev->SafetyRemoveLevel = ppdev->SafetyRemoveCount;
|
||||||
ppdev->pfnMovePointer(pso, -1, -1, NULL);
|
ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj, -1, -1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -99,19 +93,12 @@ MouseSafetyOnDrawStart(
|
||||||
*/
|
*/
|
||||||
INT INTERNAL_CALL
|
INT INTERNAL_CALL
|
||||||
MouseSafetyOnDrawEnd(
|
MouseSafetyOnDrawEnd(
|
||||||
SURFOBJ *pso)
|
PPDEVOBJ ppdev)
|
||||||
{
|
{
|
||||||
PDEVOBJ *ppdev;
|
|
||||||
GDIPOINTER *pgp;
|
GDIPOINTER *pgp;
|
||||||
|
|
||||||
ASSERT(pso != NULL);
|
ASSERT(ppdev != NULL);
|
||||||
|
ASSERT(ppdev->pSurface != NULL);
|
||||||
ppdev = (PDEVOBJ*)pso->hdev;
|
|
||||||
|
|
||||||
if (ppdev == NULL)
|
|
||||||
{
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
pgp = &ppdev->Pointer;
|
pgp = &ppdev->Pointer;
|
||||||
|
|
||||||
|
@ -125,7 +112,10 @@ MouseSafetyOnDrawEnd(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppdev->pfnMovePointer(pso, gpsi->ptCursor.x, gpsi->ptCursor.y, &pgp->Exclude);
|
ppdev->pfnMovePointer(&ppdev->pSurface->SurfObj,
|
||||||
|
gpsi->ptCursor.x,
|
||||||
|
gpsi->ptCursor.y,
|
||||||
|
&pgp->Exclude);
|
||||||
|
|
||||||
ppdev->SafetyRemoveLevel = 0;
|
ppdev->SafetyRemoveLevel = 0;
|
||||||
|
|
||||||
|
@ -175,18 +165,17 @@ IntHideMousePointer(
|
||||||
ptlSave.x = rclDest.left - pt.x;
|
ptlSave.x = rclDest.left - pt.x;
|
||||||
ptlSave.y = rclDest.top - pt.y;
|
ptlSave.y = rclDest.top - pt.y;
|
||||||
|
|
||||||
IntEngBitBltEx(psoDest,
|
IntEngBitBlt(psoDest,
|
||||||
&pgp->psurfSave->SurfObj,
|
&pgp->psurfSave->SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclDest,
|
&rclDest,
|
||||||
&ptlSave,
|
&ptlSave,
|
||||||
&ptlSave,
|
&ptlSave,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCCOPY),
|
ROP3_TO_ROP4(SRCCOPY));
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -229,77 +218,72 @@ IntShowMousePointer(PDEVOBJ *ppdev, SURFOBJ *psoDest)
|
||||||
rclPointer.bottom = min(pgp->Size.cy, psoDest->sizlBitmap.cy - pt.y);
|
rclPointer.bottom = min(pgp->Size.cy, psoDest->sizlBitmap.cy - pt.y);
|
||||||
|
|
||||||
/* Copy the pixels under the cursor to temporary surface. */
|
/* Copy the pixels under the cursor to temporary surface. */
|
||||||
IntEngBitBltEx(&pgp->psurfSave->SurfObj,
|
IntEngBitBlt(&pgp->psurfSave->SurfObj,
|
||||||
psoDest,
|
psoDest,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclPointer,
|
&rclPointer,
|
||||||
(POINTL*)&rclSurf,
|
(POINTL*)&rclSurf,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCCOPY),
|
ROP3_TO_ROP4(SRCCOPY));
|
||||||
FALSE);
|
|
||||||
|
|
||||||
/* Blt the pointer on the screen. */
|
/* Blt the pointer on the screen. */
|
||||||
if (pgp->psurfColor)
|
if (pgp->psurfColor)
|
||||||
{
|
{
|
||||||
IntEngBitBltEx(psoDest,
|
IntEngBitBlt(psoDest,
|
||||||
&pgp->psurfMask->SurfObj,
|
&pgp->psurfMask->SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclSurf,
|
&rclSurf,
|
||||||
(POINTL*)&rclPointer,
|
(POINTL*)&rclPointer,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCAND),
|
ROP3_TO_ROP4(SRCAND));
|
||||||
FALSE);
|
|
||||||
|
|
||||||
IntEngBitBltEx(psoDest,
|
IntEngBitBlt(psoDest,
|
||||||
&pgp->psurfColor->SurfObj,
|
&pgp->psurfColor->SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclSurf,
|
&rclSurf,
|
||||||
(POINTL*)&rclPointer,
|
(POINTL*)&rclPointer,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCINVERT),
|
ROP3_TO_ROP4(SRCINVERT));
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntEngBitBltEx(psoDest,
|
IntEngBitBlt(psoDest,
|
||||||
&pgp->psurfMask->SurfObj,
|
&pgp->psurfMask->SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclSurf,
|
&rclSurf,
|
||||||
(POINTL*)&rclPointer,
|
(POINTL*)&rclPointer,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCAND),
|
ROP3_TO_ROP4(SRCAND));
|
||||||
FALSE);
|
|
||||||
|
|
||||||
rclPointer.top += pgp->Size.cy;
|
rclPointer.top += pgp->Size.cy;
|
||||||
|
|
||||||
IntEngBitBltEx(psoDest,
|
IntEngBitBlt(psoDest,
|
||||||
&pgp->psurfMask->SurfObj,
|
&pgp->psurfMask->SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&rclSurf,
|
&rclSurf,
|
||||||
(POINTL*)&rclPointer,
|
(POINTL*)&rclPointer,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
ROP3_TO_ROP4(SRCINVERT),
|
ROP3_TO_ROP4(SRCINVERT));
|
||||||
FALSE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +337,7 @@ EngSetPointerShape(
|
||||||
rectl.bottom = sizel.cy;
|
rectl.bottom = sizel.cy;
|
||||||
|
|
||||||
/* Calculate lDelta for our surfaces. */
|
/* Calculate lDelta for our surfaces. */
|
||||||
lDelta = DIB_GetDIBWidthBytes(sizel.cx,
|
lDelta = WIDTH_BYTES_ALIGN32(sizel.cx,
|
||||||
BitsPerFormat(pso->iBitmapFormat));
|
BitsPerFormat(pso->iBitmapFormat));
|
||||||
|
|
||||||
/* Create a bitmap for saving the pixels under the cursor. */
|
/* Create a bitmap for saving the pixels under the cursor. */
|
||||||
|
@ -373,10 +357,10 @@ EngSetPointerShape(
|
||||||
|
|
||||||
/* Create a bitmap to copy the color bitmap to */
|
/* Create a bitmap to copy the color bitmap to */
|
||||||
hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
|
hbmColor = EngCreateBitmap(psoColor->sizlBitmap,
|
||||||
lDelta,
|
lDelta,
|
||||||
pso->iBitmapFormat,
|
pso->iBitmapFormat,
|
||||||
BMF_TOPDOWN | BMF_NOZEROINIT,
|
BMF_TOPDOWN | BMF_NOZEROINIT,
|
||||||
NULL);
|
NULL);
|
||||||
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
||||||
if (!psurfColor) goto failure;
|
if (!psurfColor) goto failure;
|
||||||
|
|
||||||
|
@ -540,28 +524,13 @@ EngMovePointer(
|
||||||
prcl->right = prcl->left + pgp->Size.cx;
|
prcl->right = prcl->left + pgp->Size.cx;
|
||||||
prcl->bottom = prcl->top + pgp->Size.cy;
|
prcl->bottom = prcl->top + pgp->Size.cy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (prcl != NULL)
|
else if (prcl != NULL)
|
||||||
{
|
{
|
||||||
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
prcl->left = prcl->top = prcl->right = prcl->bottom = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID APIENTRY
|
|
||||||
IntEngMovePointer(
|
|
||||||
IN SURFOBJ *pso,
|
|
||||||
IN LONG x,
|
|
||||||
IN LONG y,
|
|
||||||
IN RECTL *prcl)
|
|
||||||
{
|
|
||||||
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
|
||||||
PPDEVOBJ ppdev = (PPDEVOBJ)pso->hdev;
|
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurf);
|
|
||||||
ppdev->pfnMovePointer(pso, x, y, prcl);
|
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
|
||||||
}
|
|
||||||
|
|
||||||
ULONG APIENTRY
|
ULONG APIENTRY
|
||||||
IntEngSetPointerShape(
|
IntEngSetPointerShape(
|
||||||
IN SURFOBJ *pso,
|
IN SURFOBJ *pso,
|
||||||
|
@ -576,13 +545,11 @@ IntEngSetPointerShape(
|
||||||
IN FLONG fl)
|
IN FLONG fl)
|
||||||
{
|
{
|
||||||
ULONG ulResult = SPS_DECLINE;
|
ULONG ulResult = SPS_DECLINE;
|
||||||
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
|
||||||
PFN_DrvSetPointerShape pfnSetPointerShape;
|
PFN_DrvSetPointerShape pfnSetPointerShape;
|
||||||
PPDEVOBJ ppdev = GDIDEV(pso);
|
PPDEVOBJ ppdev = GDIDEV(pso);
|
||||||
|
|
||||||
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
|
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
|
||||||
|
|
||||||
SURFACE_LockBitmapBits(psurf);
|
|
||||||
if (pfnSetPointerShape)
|
if (pfnSetPointerShape)
|
||||||
{
|
{
|
||||||
ulResult = pfnSetPointerShape(pso,
|
ulResult = pfnSetPointerShape(pso,
|
||||||
|
@ -620,8 +587,6 @@ IntEngSetPointerShape(
|
||||||
ppdev->pfnMovePointer = EngMovePointer;
|
ppdev->pfnMovePointer = EngMovePointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
|
||||||
|
|
||||||
return ulResult;
|
return ulResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,10 +614,14 @@ GreSetPointerShape(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
psurf = pdc->dclevel.pSurface;
|
ASSERT(pdc->dctype == DCTYPE_DIRECT);
|
||||||
|
EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
|
/* We're not sure DC surface is the good one */
|
||||||
|
psurf = pdc->ppdev->pSurface;
|
||||||
if (!psurf)
|
if (!psurf)
|
||||||
{
|
{
|
||||||
DPRINT1("DC has no surface.\n");
|
DPRINT1("DC has no surface.\n");
|
||||||
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
DC_UnlockDc(pdc);
|
DC_UnlockDc(pdc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -668,7 +637,7 @@ GreSetPointerShape(
|
||||||
{
|
{
|
||||||
/* We have one, lock it */
|
/* We have one, lock it */
|
||||||
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
psurfColor = SURFACE_ShareLockSurface(hbmColor);
|
||||||
|
|
||||||
if (psurfColor)
|
if (psurfColor)
|
||||||
{
|
{
|
||||||
/* Create an XLATEOBJ, no mono support */
|
/* Create an XLATEOBJ, no mono support */
|
||||||
|
@ -700,6 +669,8 @@ GreSetPointerShape(
|
||||||
if (psurfMask)
|
if (psurfMask)
|
||||||
SURFACE_ShareUnlockSurface(psurfMask);
|
SURFACE_ShareUnlockSurface(psurfMask);
|
||||||
|
|
||||||
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
|
|
||||||
/* Unlock the DC */
|
/* Unlock the DC */
|
||||||
DC_UnlockDc(pdc);
|
DC_UnlockDc(pdc);
|
||||||
|
|
||||||
|
@ -724,12 +695,23 @@ GreMovePointer(
|
||||||
DPRINT1("Failed to lock the DC.\n");
|
DPRINT1("Failed to lock the DC.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ASSERT(pdc->dctype == DCTYPE_DIRECT);
|
||||||
|
|
||||||
/* Store the cursor exclude position in the PDEV */
|
/* Acquire PDEV lock */
|
||||||
prcl = &pdc->ppdev->Pointer.Exclude;
|
EngAcquireSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
|
|
||||||
/* Call Eng/Drv function */
|
/* Check if we need to move it */
|
||||||
IntEngMovePointer(&pdc->dclevel.pSurface->SurfObj, x, y, prcl);
|
if(pdc->ppdev->SafetyRemoveLevel == 0)
|
||||||
|
{
|
||||||
|
/* Store the cursor exclude position in the PDEV */
|
||||||
|
prcl = &pdc->ppdev->Pointer.Exclude;
|
||||||
|
|
||||||
|
/* Call Eng/Drv function */
|
||||||
|
pdc->ppdev->pfnMovePointer(&pdc->ppdev->pSurface->SurfObj, x, y, prcl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release PDEV lock */
|
||||||
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
|
|
||||||
/* Unlock the DC */
|
/* Unlock the DC */
|
||||||
DC_UnlockDc(pdc);
|
DC_UnlockDc(pdc);
|
||||||
|
|
|
@ -32,14 +32,13 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
||||||
{
|
{
|
||||||
LONG y;
|
LONG y;
|
||||||
ULONG LineWidth;
|
ULONG LineWidth;
|
||||||
|
|
||||||
ASSERT(pso);
|
ASSERT(pso);
|
||||||
ASSERT(pRect);
|
ASSERT(pRect);
|
||||||
MouseSafetyOnDrawStart(pso, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
|
||||||
LineWidth = pRect->right - pRect->left;
|
LineWidth = pRect->right - pRect->left;
|
||||||
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
||||||
for (y = pRect->top; y < pRect->bottom; y++)
|
for (y = pRect->top; y < pRect->bottom; y++)
|
||||||
|
@ -47,22 +46,9 @@ static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
||||||
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine(
|
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine(
|
||||||
pso, pRect->left, pRect->right, y, iColor);
|
pso, pRect->left, pRect->right, y, iColor);
|
||||||
}
|
}
|
||||||
MouseSafetyOnDrawEnd(pso);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
|
||||||
{
|
|
||||||
SURFACE *psurf;
|
|
||||||
BOOL Result;
|
|
||||||
psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
|
||||||
SURFACE_LockBitmapBits(psurf);
|
|
||||||
Result = FillSolidUnlocked(pso, pRect, iColor);
|
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
||||||
BRUSHOBJ *BrushObj, POINTL *BrushPoint)
|
BRUSHOBJ *BrushObj, POINTL *BrushPoint)
|
||||||
|
@ -85,7 +71,7 @@ EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
||||||
|
|
||||||
if (ClipRegion->iDComplexity == DC_RECT)
|
if (ClipRegion->iDComplexity == DC_RECT)
|
||||||
{
|
{
|
||||||
FillSolidUnlocked(pso, &(ClipRegion->rclBounds), iColor);
|
FillSolid(pso, &(ClipRegion->rclBounds), iColor);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Enumerate all the rectangles and draw them */
|
/* Enumerate all the rectangles and draw them */
|
||||||
|
@ -94,7 +80,7 @@ EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
||||||
do {
|
do {
|
||||||
EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c; i++) {
|
for (i = 0; i < RectEnum.c; i++) {
|
||||||
FillSolidUnlocked(pso, RectEnum.arcl + i, iColor);
|
FillSolid(pso, RectEnum.arcl + i, iColor);
|
||||||
}
|
}
|
||||||
} while (EnumMore);
|
} while (EnumMore);
|
||||||
}
|
}
|
||||||
|
@ -136,18 +122,11 @@ IntEngPaint(IN SURFOBJ *pso,
|
||||||
|
|
||||||
DPRINT("pso->iType == %d\n", pso->iType);
|
DPRINT("pso->iType == %d\n", pso->iType);
|
||||||
/* Is the surface's Paint function hooked? */
|
/* Is the surface's Paint function hooked? */
|
||||||
if((pso->iType!=STYPE_BITMAP) && (psurf->flHooks & HOOK_PAINT))
|
if((pso->iType!=STYPE_BITMAP) && (psurf->flags & HOOK_PAINT))
|
||||||
{
|
{
|
||||||
// Call the driver's DrvPaint
|
// Call the driver's DrvPaint
|
||||||
SURFACE_LockBitmapBits(psurf);
|
|
||||||
MouseSafetyOnDrawStart(pso, ClipRegion->rclBounds.left,
|
|
||||||
ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
|
|
||||||
ClipRegion->rclBounds.bottom);
|
|
||||||
|
|
||||||
ret = GDIDEVFUNCS(pso).Paint(
|
ret = GDIDEVFUNCS(pso).Paint(
|
||||||
pso, ClipRegion, Brush, BrushOrigin, Mix);
|
pso, ClipRegion, Brush, BrushOrigin, Mix);
|
||||||
MouseSafetyOnDrawEnd(pso);
|
|
||||||
SURFACE_UnlockBitmapBits(psurf);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix );
|
return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix );
|
||||||
|
|
844
subsystems/win32/win32k/eng/pdevobj.c
Normal file
844
subsystems/win32/win32k/eng/pdevobj.c
Normal file
|
@ -0,0 +1,844 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: Support for physical devices
|
||||||
|
* FILE: subsystems/win32/win32k/eng/pdevobj.c
|
||||||
|
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <win32k.h>
|
||||||
|
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
PPDEVOBJ gppdevPrimary = NULL;
|
||||||
|
|
||||||
|
static PPDEVOBJ gppdevList = NULL;
|
||||||
|
static HSEMAPHORE ghsemPDEV;
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitPDEVImpl()
|
||||||
|
{
|
||||||
|
ghsemPDEV = EngCreateSemaphore();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PPDEVOBJ
|
||||||
|
PDEVOBJ_AllocPDEV()
|
||||||
|
{
|
||||||
|
PPDEVOBJ ppdev;
|
||||||
|
|
||||||
|
ppdev = ExAllocatePoolWithTag(PagedPool, sizeof(PDEVOBJ), GDITAG_PDEV);
|
||||||
|
if (!ppdev)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
RtlZeroMemory(ppdev, sizeof(PDEVOBJ));
|
||||||
|
|
||||||
|
ppdev->cPdevRefs = 1;
|
||||||
|
|
||||||
|
return ppdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vRelease(PPDEVOBJ ppdev)
|
||||||
|
{
|
||||||
|
/* Lock loader */
|
||||||
|
EngAcquireSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
/* Decrease reference count */
|
||||||
|
--ppdev->cPdevRefs;
|
||||||
|
|
||||||
|
ASSERT(ppdev->cPdevRefs >= 0) ;
|
||||||
|
|
||||||
|
/* Check if references are left */
|
||||||
|
if (ppdev->cPdevRefs == 0)
|
||||||
|
{
|
||||||
|
/* Do we have a surface? */
|
||||||
|
if(ppdev->pSurface)
|
||||||
|
{
|
||||||
|
/* Release the surface and let the driver free it */
|
||||||
|
SURFACE_ShareUnlockSurface(ppdev->pSurface);
|
||||||
|
ppdev->pfn.DisableSurface(ppdev->dhpdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have a palette? */
|
||||||
|
if(ppdev->ppalSurf)
|
||||||
|
{
|
||||||
|
PALETTE_ShareUnlockPalette(ppdev->ppalSurf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable PDEV */
|
||||||
|
ppdev->pfn.DisablePDEV(ppdev->dhpdev);
|
||||||
|
|
||||||
|
/* Remove it from list */
|
||||||
|
if( ppdev == gppdevList )
|
||||||
|
gppdevList = ppdev->ppdevNext ;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PPDEVOBJ ppdevCurrent = gppdevList;
|
||||||
|
BOOL found = FALSE ;
|
||||||
|
while (!found && ppdevCurrent->ppdevNext)
|
||||||
|
{
|
||||||
|
if (ppdevCurrent->ppdevNext == ppdev)
|
||||||
|
found = TRUE;
|
||||||
|
else
|
||||||
|
ppdevCurrent = ppdevCurrent->ppdevNext ;
|
||||||
|
}
|
||||||
|
if(found)
|
||||||
|
ppdevCurrent->ppdevNext = ppdev->ppdevNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is this the primary one ? */
|
||||||
|
if (ppdev == gppdevPrimary)
|
||||||
|
gppdevPrimary = NULL;
|
||||||
|
|
||||||
|
/* Free it */
|
||||||
|
ExFreePoolWithTag(ppdev, GDITAG_PDEV );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlock loader */
|
||||||
|
EngReleaseSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_bEnablePDEV(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVMODEW pdevmode,
|
||||||
|
PWSTR pwszLogAddress)
|
||||||
|
{
|
||||||
|
PFN_DrvEnablePDEV pfnEnablePDEV;
|
||||||
|
|
||||||
|
DPRINT1("PDEVOBJ_bEnablePDEV()\n");
|
||||||
|
|
||||||
|
/* Get the DrvEnablePDEV function */
|
||||||
|
pfnEnablePDEV = ppdev->pldev->pfn.EnablePDEV;
|
||||||
|
|
||||||
|
/* Call the drivers DrvEnablePDEV function */
|
||||||
|
ppdev->dhpdev = pfnEnablePDEV(pdevmode,
|
||||||
|
pwszLogAddress,
|
||||||
|
HS_DDI_MAX,
|
||||||
|
ppdev->ahsurf,
|
||||||
|
sizeof(GDIINFO),
|
||||||
|
&ppdev->gdiinfo,
|
||||||
|
sizeof(DEVINFO),
|
||||||
|
&ppdev->devinfo,
|
||||||
|
(HDEV)ppdev,
|
||||||
|
ppdev->pGraphicsDevice->pwszDescription,
|
||||||
|
ppdev->pGraphicsDevice->DeviceObject);
|
||||||
|
|
||||||
|
/* Fix up some values */
|
||||||
|
if (ppdev->gdiinfo.ulLogPixelsX == 0)
|
||||||
|
ppdev->gdiinfo.ulLogPixelsX = 96;
|
||||||
|
|
||||||
|
if (ppdev->gdiinfo.ulLogPixelsY == 0)
|
||||||
|
ppdev->gdiinfo.ulLogPixelsY = 96;
|
||||||
|
|
||||||
|
/* Setup Palette */
|
||||||
|
GDIOBJ_SetOwnership(ppdev->devinfo.hpalDefault, NULL);
|
||||||
|
ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
|
||||||
|
|
||||||
|
DPRINT1("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vCompletePDEV(
|
||||||
|
PPDEVOBJ ppdev)
|
||||||
|
{
|
||||||
|
/* Call the drivers DrvCompletePDEV function */
|
||||||
|
ppdev->pldev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
PSURFACE
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_pSurface(
|
||||||
|
PPDEVOBJ ppdev)
|
||||||
|
{
|
||||||
|
HSURF hsurf;
|
||||||
|
|
||||||
|
/* Check if we already have a surface */
|
||||||
|
if (ppdev->pSurface)
|
||||||
|
{
|
||||||
|
/* Increment reference count */
|
||||||
|
GDIOBJ_IncrementShareCount(&ppdev->pSurface->BaseObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Call the drivers DrvEnableSurface */
|
||||||
|
hsurf = ppdev->pldev->pfn.EnableSurface(ppdev->dhpdev);
|
||||||
|
|
||||||
|
/* Lock the surface */
|
||||||
|
ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
|
||||||
|
return ppdev->pSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
PDEVMODEW
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_pdmMatchDevMode(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVMODEW pdm)
|
||||||
|
{
|
||||||
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
|
PDEVMODEW pdmCurrent;
|
||||||
|
INT i;
|
||||||
|
DWORD dwFields;
|
||||||
|
|
||||||
|
pGraphicsDevice = ppdev->pGraphicsDevice;
|
||||||
|
|
||||||
|
for (i = 0; i < pGraphicsDevice->cDevModes; i++)
|
||||||
|
{
|
||||||
|
pdmCurrent = pGraphicsDevice->pDevModeList[i].pdm;
|
||||||
|
|
||||||
|
/* Compare asked DEVMODE fields
|
||||||
|
* Only compare those that are valid in both DEVMODE structs */
|
||||||
|
dwFields = pdmCurrent->dmFields & pdm->dmFields ;
|
||||||
|
/* For now, we only need those */
|
||||||
|
if ((dwFields & DM_BITSPERPEL) &&
|
||||||
|
(pdmCurrent->dmBitsPerPel != pdm->dmBitsPerPel))
|
||||||
|
continue;
|
||||||
|
if ((dwFields & DM_PELSWIDTH) &&
|
||||||
|
(pdmCurrent->dmPelsWidth != pdm->dmPelsWidth))
|
||||||
|
continue;
|
||||||
|
if ((dwFields & DM_PELSHEIGHT) &&
|
||||||
|
(pdmCurrent->dmPelsHeight != pdm->dmPelsHeight))
|
||||||
|
continue;
|
||||||
|
if ((dwFields & DM_DISPLAYFREQUENCY) &&
|
||||||
|
(pdmCurrent->dmDisplayFrequency != pdm->dmDisplayFrequency))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Match! Return the DEVMODE */
|
||||||
|
return pdmCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nothing found */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PPDEVOBJ
|
||||||
|
EngpCreatePDEV(
|
||||||
|
PUNICODE_STRING pustrDeviceName,
|
||||||
|
PDEVMODEW pdm)
|
||||||
|
{
|
||||||
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
|
PPDEVOBJ ppdev;
|
||||||
|
|
||||||
|
/* Try to find the GRAPHICS_DEVICE */
|
||||||
|
if (pustrDeviceName)
|
||||||
|
{
|
||||||
|
pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
|
||||||
|
if (!pGraphicsDevice)
|
||||||
|
{
|
||||||
|
DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
|
||||||
|
pustrDeviceName ? pustrDeviceName->Buffer : 0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pGraphicsDevice = gpPrimaryGraphicsDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a new PDEVOBJ */
|
||||||
|
ppdev = PDEVOBJ_AllocPDEV();
|
||||||
|
if (!ppdev)
|
||||||
|
{
|
||||||
|
DPRINT1("failed to allocate a PDEV\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If no DEVMODEW is given, ... */
|
||||||
|
if (!pdm)
|
||||||
|
{
|
||||||
|
/* ... use the device's default one */
|
||||||
|
pdm = pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm;
|
||||||
|
DPRINT1("Using iDefaultMode = %ld\n", pGraphicsDevice->iDefaultMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to get a diplay driver */
|
||||||
|
ppdev->pldev = EngLoadImageEx(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY);
|
||||||
|
if (!ppdev->pldev)
|
||||||
|
{
|
||||||
|
DPRINT1("Could not load display driver '%ls'\n",
|
||||||
|
pGraphicsDevice->pDiplayDrivers);
|
||||||
|
ExFreePoolWithTag(ppdev, GDITAG_PDEV);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy the function table */
|
||||||
|
ppdev->pfn = ppdev->pldev->pfn;
|
||||||
|
|
||||||
|
/* Set MovePointer function */
|
||||||
|
ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
|
||||||
|
if (!ppdev->pfnMovePointer)
|
||||||
|
ppdev->pfnMovePointer = EngMovePointer;
|
||||||
|
|
||||||
|
ppdev->pGraphicsDevice = pGraphicsDevice;
|
||||||
|
ppdev->hsemDevLock = EngCreateSemaphore();
|
||||||
|
// Should we change the ative mode of pGraphicsDevice ?
|
||||||
|
ppdev->pdmwDev = PDEVOBJ_pdmMatchDevMode(ppdev, pdm) ;
|
||||||
|
|
||||||
|
/* FIXME! */
|
||||||
|
ppdev->flFlags = PDEV_DISPLAY;
|
||||||
|
|
||||||
|
/* HACK: Don't use the pointer */
|
||||||
|
ppdev->Pointer.Exclude.right = -1;
|
||||||
|
|
||||||
|
/* Call the driver to enable the PDEV */
|
||||||
|
if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to enable PDEV!\n");
|
||||||
|
ASSERT(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: this must be done in a better way */
|
||||||
|
pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_ATTACHED_TO_DESKTOP;
|
||||||
|
|
||||||
|
/* Tell the driver that the PDEV is ready */
|
||||||
|
PDEVOBJ_vCompletePDEV(ppdev);
|
||||||
|
|
||||||
|
/* Return the PDEV */
|
||||||
|
return ppdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vSwitchPdev(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PPDEVOBJ ppdev2)
|
||||||
|
{
|
||||||
|
PDEVOBJ pdevTmp;
|
||||||
|
DWORD tmpStateFlags;
|
||||||
|
|
||||||
|
/* Exchange data */
|
||||||
|
pdevTmp = *ppdev;
|
||||||
|
|
||||||
|
/* Exchange driver functions */
|
||||||
|
ppdev->pfn = ppdev2->pfn;
|
||||||
|
ppdev2->pfn = pdevTmp.pfn;
|
||||||
|
|
||||||
|
/* Exchange LDEVs */
|
||||||
|
ppdev->pldev = ppdev2->pldev;
|
||||||
|
ppdev2->pldev = pdevTmp.pldev;
|
||||||
|
|
||||||
|
/* Exchange DHPDEV */
|
||||||
|
ppdev->dhpdev = ppdev2->dhpdev;
|
||||||
|
ppdev2->dhpdev = pdevTmp.dhpdev;
|
||||||
|
|
||||||
|
/* Exchange surfaces and associate them with their new PDEV */
|
||||||
|
ppdev->pSurface = ppdev2->pSurface;
|
||||||
|
ppdev2->pSurface = pdevTmp.pSurface;
|
||||||
|
ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
|
||||||
|
ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
|
||||||
|
|
||||||
|
/* Exchange devinfo */
|
||||||
|
ppdev->devinfo = ppdev2->devinfo;
|
||||||
|
ppdev2->devinfo = pdevTmp.devinfo;
|
||||||
|
|
||||||
|
/* Exchange gdiinfo */
|
||||||
|
ppdev->gdiinfo = ppdev2->gdiinfo;
|
||||||
|
ppdev2->gdiinfo = pdevTmp.gdiinfo;
|
||||||
|
|
||||||
|
/* Exchange DEVMODE */
|
||||||
|
ppdev->pdmwDev = ppdev2->pdmwDev;
|
||||||
|
ppdev2->pdmwDev = pdevTmp.pdmwDev;
|
||||||
|
|
||||||
|
/* Exchange state flags */
|
||||||
|
tmpStateFlags = ppdev->pGraphicsDevice->StateFlags;
|
||||||
|
ppdev->pGraphicsDevice->StateFlags = ppdev2->pGraphicsDevice->StateFlags;
|
||||||
|
ppdev2->pGraphicsDevice->StateFlags = tmpStateFlags;
|
||||||
|
|
||||||
|
/* Notify each driver instance of its new HDEV association */
|
||||||
|
ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
|
||||||
|
ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_bSwitchMode(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVMODEW pdm)
|
||||||
|
{
|
||||||
|
UNICODE_STRING ustrDevice;
|
||||||
|
PPDEVOBJ ppdevTmp;
|
||||||
|
PSURFACE pSurface;
|
||||||
|
BOOL retval = FALSE;
|
||||||
|
|
||||||
|
/* Lock the PDEV */
|
||||||
|
EngAcquireSemaphore(ppdev->hsemDevLock);
|
||||||
|
/* And everything else */
|
||||||
|
EngAcquireSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
|
||||||
|
|
||||||
|
// Lookup the GraphicsDevice + select DEVMODE
|
||||||
|
// pdm = PDEVOBJ_pdmMatchDevMode(ppdev, pdm);
|
||||||
|
|
||||||
|
/* 1. Temporarily disable the current PDEV */
|
||||||
|
if (!ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE))
|
||||||
|
{
|
||||||
|
DPRINT1("DrvAssertMode failed\n");
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. Create new PDEV */
|
||||||
|
RtlInitUnicodeString(&ustrDevice, ppdev->pGraphicsDevice->szWinDeviceName);
|
||||||
|
ppdevTmp = EngpCreatePDEV(&ustrDevice, pdm);
|
||||||
|
if (!ppdevTmp)
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create a new PDEV\n");
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 3. Create a new surface */
|
||||||
|
pSurface = PDEVOBJ_pSurface(ppdevTmp);
|
||||||
|
if (!pSurface)
|
||||||
|
{
|
||||||
|
DPRINT1("DrvEnableSurface failed\n");
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4. Get DirectDraw information */
|
||||||
|
/* 5. Enable DirectDraw Not traced */
|
||||||
|
/* 6. Copy old PDEV state to new PDEV instance */
|
||||||
|
|
||||||
|
/* 7. Switch the PDEVs */
|
||||||
|
PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
|
||||||
|
|
||||||
|
/* 8. Disable DirectDraw */
|
||||||
|
|
||||||
|
PDEVOBJ_vRelease(ppdevTmp);
|
||||||
|
|
||||||
|
/* Update primary display capabilities */
|
||||||
|
if(ppdev == gppdevPrimary)
|
||||||
|
{
|
||||||
|
PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success! */
|
||||||
|
retval = TRUE;
|
||||||
|
leave:
|
||||||
|
/* Unlock PDEV */
|
||||||
|
EngReleaseSemaphore(ppdev->hsemDevLock);
|
||||||
|
EngReleaseSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PPDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
EngpGetPDEV(
|
||||||
|
PUNICODE_STRING pustrDeviceName)
|
||||||
|
{
|
||||||
|
UNICODE_STRING ustrCurrent;
|
||||||
|
PPDEVOBJ ppdev;
|
||||||
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
|
|
||||||
|
/* Acquire PDEV lock */
|
||||||
|
EngAcquireSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
/* If no device name is given, ... */
|
||||||
|
if (!pustrDeviceName && gppdevPrimary)
|
||||||
|
{
|
||||||
|
/* ... use the primary PDEV */
|
||||||
|
ppdev = gppdevPrimary;
|
||||||
|
|
||||||
|
/* Reference the pdev */
|
||||||
|
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Loop all present PDEVs */
|
||||||
|
for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
|
||||||
|
{
|
||||||
|
/* Get a pointer to the GRAPHICS_DEVICE */
|
||||||
|
pGraphicsDevice = ppdev->pGraphicsDevice;
|
||||||
|
|
||||||
|
/* Compare the name */
|
||||||
|
RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
|
||||||
|
if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE))
|
||||||
|
{
|
||||||
|
/* Found! Reference the PDEV */
|
||||||
|
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Did we find one? */
|
||||||
|
if (!ppdev)
|
||||||
|
{
|
||||||
|
/* No, create a new PDEV */
|
||||||
|
ppdev = EngpCreatePDEV(pustrDeviceName, NULL);
|
||||||
|
if (ppdev)
|
||||||
|
{
|
||||||
|
/* Insert the PDEV into the list */
|
||||||
|
ppdev->ppdevNext = gppdevList;
|
||||||
|
gppdevList = ppdev;
|
||||||
|
|
||||||
|
/* Set as primary PDEV, if we don't have one yet */
|
||||||
|
if (!gppdevPrimary)
|
||||||
|
{
|
||||||
|
gppdevPrimary = ppdev;
|
||||||
|
ppdev->pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_PRIMARY_DEVICE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leave:
|
||||||
|
/* Release PDEV lock */
|
||||||
|
EngReleaseSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
return ppdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_iGetColorManagementCaps(PPDEVOBJ ppdev)
|
||||||
|
{
|
||||||
|
INT ret = CM_NONE;
|
||||||
|
|
||||||
|
if (ppdev->flFlags & PDEV_DISPLAY)
|
||||||
|
{
|
||||||
|
if (ppdev->devinfo.iDitherFormat == BMF_8BPP ||
|
||||||
|
ppdev->devinfo.flGraphicsCaps2 & GCAPS2_CHANGEGAMMARAMP)
|
||||||
|
ret = CM_GAMMA_RAMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ppdev->devinfo.flGraphicsCaps & GCAPS_CMYKCOLOR)
|
||||||
|
ret |= CM_CMYK_COLOR;
|
||||||
|
if (ppdev->devinfo.flGraphicsCaps & GCAPS_ICM)
|
||||||
|
ret |= CM_DEVICE_ICM;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vGetDeviceCaps(
|
||||||
|
IN PPDEVOBJ ppdev,
|
||||||
|
OUT PDEVCAPS pDevCaps)
|
||||||
|
{
|
||||||
|
PGDIINFO pGdiInfo = &ppdev->gdiinfo;
|
||||||
|
|
||||||
|
pDevCaps->ulVersion = pGdiInfo->ulVersion;
|
||||||
|
pDevCaps->ulTechnology = pGdiInfo->ulTechnology;
|
||||||
|
pDevCaps->ulHorzSizeM = (pGdiInfo->ulHorzSize + 500) / 1000;
|
||||||
|
pDevCaps->ulVertSizeM = (pGdiInfo->ulVertSize + 500) / 1000;
|
||||||
|
pDevCaps->ulHorzSize = pGdiInfo->ulHorzSize;
|
||||||
|
pDevCaps->ulVertSize = pGdiInfo->ulVertSize;
|
||||||
|
pDevCaps->ulHorzRes = pGdiInfo->ulHorzRes;
|
||||||
|
pDevCaps->ulVertRes = pGdiInfo->ulVertRes;
|
||||||
|
pDevCaps->ulBitsPixel = pGdiInfo->cBitsPixel;
|
||||||
|
if (pDevCaps->ulBitsPixel == 15) pDevCaps->ulBitsPixel = 16;
|
||||||
|
pDevCaps->ulPlanes = pGdiInfo->cPlanes;
|
||||||
|
pDevCaps->ulNumPens = pGdiInfo->ulNumColors;
|
||||||
|
if (pDevCaps->ulNumPens != -1) pDevCaps->ulNumPens *= 5;
|
||||||
|
pDevCaps->ulNumFonts = 0; // PDEVOBJ_cFonts(ppdev);
|
||||||
|
pDevCaps->ulNumColors = pGdiInfo->ulNumColors;
|
||||||
|
pDevCaps->ulRasterCaps = pGdiInfo->flRaster;
|
||||||
|
pDevCaps->ulAspectX = pGdiInfo->ulAspectX;
|
||||||
|
pDevCaps->ulAspectY = pGdiInfo->ulAspectY;
|
||||||
|
pDevCaps->ulAspectXY = pGdiInfo->ulAspectXY;
|
||||||
|
pDevCaps->ulLogPixelsX = pGdiInfo->ulLogPixelsX;
|
||||||
|
pDevCaps->ulLogPixelsY = pGdiInfo->ulLogPixelsY;
|
||||||
|
pDevCaps->ulSizePalette = pGdiInfo->ulNumPalReg;
|
||||||
|
pDevCaps->ulColorRes = pGdiInfo->ulDACRed +
|
||||||
|
pGdiInfo->ulDACGreen +
|
||||||
|
pGdiInfo->ulDACBlue;
|
||||||
|
pDevCaps->ulPhysicalWidth = pGdiInfo->szlPhysSize.cx;
|
||||||
|
pDevCaps->ulPhysicalHeight = pGdiInfo->szlPhysSize.cy;
|
||||||
|
pDevCaps->ulPhysicalOffsetX = pGdiInfo->ptlPhysOffset.x;
|
||||||
|
pDevCaps->ulPhysicalOffsetY = pGdiInfo->ptlPhysOffset.y;
|
||||||
|
pDevCaps->ulTextCaps = pGdiInfo->flTextCaps;
|
||||||
|
pDevCaps->ulTextCaps |= (TC_SO_ABLE|TC_UA_ABLE|TC_CP_STROKE|TC_OP_STROKE|TC_OP_CHARACTER);
|
||||||
|
if (pGdiInfo->ulTechnology != DT_PLOTTER)
|
||||||
|
pDevCaps->ulTextCaps |= TC_VA_ABLE;
|
||||||
|
pDevCaps->ulVRefresh = pGdiInfo->ulVRefresh;
|
||||||
|
pDevCaps->ulDesktopHorzRes = pGdiInfo->ulHorzRes;
|
||||||
|
pDevCaps->ulDesktopVertRes = pGdiInfo->ulVertRes;
|
||||||
|
pDevCaps->ulBltAlignment = pGdiInfo->ulBltAlignment;
|
||||||
|
pDevCaps->ulPanningHorzRes = pGdiInfo->ulPanningHorzRes;
|
||||||
|
pDevCaps->ulPanningVertRes = pGdiInfo->ulPanningVertRes;
|
||||||
|
pDevCaps->xPanningAlignment = pGdiInfo->xPanningAlignment;
|
||||||
|
pDevCaps->yPanningAlignment = pGdiInfo->yPanningAlignment;
|
||||||
|
pDevCaps->ulShadeBlend = pGdiInfo->flShadeBlend;
|
||||||
|
pDevCaps->ulColorMgmtCaps = PDEVOBJ_iGetColorManagementCaps(ppdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Exported functions ********************************************************/
|
||||||
|
|
||||||
|
LPWSTR
|
||||||
|
APIENTRY
|
||||||
|
EngGetDriverName(IN HDEV hdev)
|
||||||
|
{
|
||||||
|
PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
|
||||||
|
PLDEVOBJ pldev;
|
||||||
|
|
||||||
|
if (!hdev)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pldev = ppdev->pldev;
|
||||||
|
ASSERT(pldev);
|
||||||
|
|
||||||
|
if (!pldev->pGdiDriverInfo)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return pldev->pGdiDriverInfo->DriverName.Buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INT
|
||||||
|
APIENTRY
|
||||||
|
NtGdiGetDeviceCaps(
|
||||||
|
HDC hdc,
|
||||||
|
INT Index)
|
||||||
|
{
|
||||||
|
PDC pdc;
|
||||||
|
DEVCAPS devcaps;
|
||||||
|
|
||||||
|
/* Lock the given DC */
|
||||||
|
pdc = DC_LockDc(hdc);
|
||||||
|
if (!pdc)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the data */
|
||||||
|
PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
|
||||||
|
|
||||||
|
/* Unlock the DC */
|
||||||
|
DC_UnlockDc(pdc);
|
||||||
|
|
||||||
|
/* Return capability */
|
||||||
|
switch (Index)
|
||||||
|
{
|
||||||
|
case DRIVERVERSION:
|
||||||
|
return devcaps.ulVersion;
|
||||||
|
|
||||||
|
case TECHNOLOGY:
|
||||||
|
return devcaps.ulTechnology;
|
||||||
|
|
||||||
|
case HORZSIZE:
|
||||||
|
return devcaps.ulHorzSize;
|
||||||
|
|
||||||
|
case VERTSIZE:
|
||||||
|
return devcaps.ulVertSize;
|
||||||
|
|
||||||
|
case HORZRES:
|
||||||
|
return devcaps.ulHorzRes;
|
||||||
|
|
||||||
|
case VERTRES:
|
||||||
|
return devcaps.ulVertRes;
|
||||||
|
|
||||||
|
case LOGPIXELSX:
|
||||||
|
return devcaps.ulLogPixelsX;
|
||||||
|
|
||||||
|
case LOGPIXELSY:
|
||||||
|
return devcaps.ulLogPixelsY;
|
||||||
|
|
||||||
|
case BITSPIXEL:
|
||||||
|
return devcaps.ulBitsPixel;
|
||||||
|
|
||||||
|
case PLANES:
|
||||||
|
return devcaps.ulPlanes;
|
||||||
|
|
||||||
|
case NUMBRUSHES:
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
case NUMPENS:
|
||||||
|
return devcaps.ulNumPens;
|
||||||
|
|
||||||
|
case NUMFONTS:
|
||||||
|
return devcaps.ulNumFonts;
|
||||||
|
|
||||||
|
case NUMCOLORS:
|
||||||
|
return devcaps.ulNumColors;
|
||||||
|
|
||||||
|
case ASPECTX:
|
||||||
|
return devcaps.ulAspectX;
|
||||||
|
|
||||||
|
case ASPECTY:
|
||||||
|
return devcaps.ulAspectY;
|
||||||
|
|
||||||
|
case ASPECTXY:
|
||||||
|
return devcaps.ulAspectXY;
|
||||||
|
|
||||||
|
case CLIPCAPS:
|
||||||
|
return CP_RECTANGLE;
|
||||||
|
|
||||||
|
case SIZEPALETTE:
|
||||||
|
return devcaps.ulSizePalette;
|
||||||
|
|
||||||
|
case NUMRESERVED:
|
||||||
|
return 20;
|
||||||
|
|
||||||
|
case COLORRES:
|
||||||
|
return devcaps.ulColorRes;
|
||||||
|
|
||||||
|
case DESKTOPVERTRES:
|
||||||
|
return devcaps.ulVertRes;
|
||||||
|
|
||||||
|
case DESKTOPHORZRES:
|
||||||
|
return devcaps.ulHorzRes;
|
||||||
|
|
||||||
|
case BLTALIGNMENT:
|
||||||
|
return devcaps.ulBltAlignment;
|
||||||
|
|
||||||
|
case SHADEBLENDCAPS:
|
||||||
|
return devcaps.ulShadeBlend;
|
||||||
|
|
||||||
|
case COLORMGMTCAPS:
|
||||||
|
return devcaps.ulColorMgmtCaps;
|
||||||
|
|
||||||
|
case PHYSICALWIDTH:
|
||||||
|
return devcaps.ulPhysicalWidth;
|
||||||
|
|
||||||
|
case PHYSICALHEIGHT:
|
||||||
|
return devcaps.ulPhysicalHeight;
|
||||||
|
|
||||||
|
case PHYSICALOFFSETX:
|
||||||
|
return devcaps.ulPhysicalOffsetX;
|
||||||
|
|
||||||
|
case PHYSICALOFFSETY:
|
||||||
|
return devcaps.ulPhysicalOffsetY;
|
||||||
|
|
||||||
|
case VREFRESH:
|
||||||
|
return devcaps.ulVRefresh;
|
||||||
|
|
||||||
|
case RASTERCAPS:
|
||||||
|
return devcaps.ulRasterCaps;
|
||||||
|
|
||||||
|
case CURVECAPS:
|
||||||
|
return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
|
||||||
|
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
|
||||||
|
|
||||||
|
case LINECAPS:
|
||||||
|
return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
|
||||||
|
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
|
||||||
|
|
||||||
|
case POLYGONALCAPS:
|
||||||
|
return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
|
||||||
|
PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
|
||||||
|
|
||||||
|
case TEXTCAPS:
|
||||||
|
return devcaps.ulTextCaps;
|
||||||
|
|
||||||
|
case CAPS1:
|
||||||
|
case PDEVICESIZE:
|
||||||
|
case SCALINGFACTORX:
|
||||||
|
case SCALINGFACTORY:
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
APIENTRY
|
||||||
|
NtGdiGetDeviceCapsAll(
|
||||||
|
IN HDC hDC,
|
||||||
|
OUT PDEVCAPS pDevCaps)
|
||||||
|
{
|
||||||
|
PDC pdc;
|
||||||
|
DEVCAPS devcaps;
|
||||||
|
BOOL bResult = TRUE;
|
||||||
|
|
||||||
|
/* Lock the given DC */
|
||||||
|
pdc = DC_LockDc(hDC);
|
||||||
|
if (!pdc)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the data */
|
||||||
|
PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
|
||||||
|
|
||||||
|
/* Unlock the DC */
|
||||||
|
DC_UnlockDc(pdc);
|
||||||
|
|
||||||
|
/* Copy data to caller */
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
ProbeForWrite(pDevCaps, sizeof(DEVCAPS), 1);
|
||||||
|
RtlCopyMemory(pDevCaps, &devcaps, sizeof(DEVCAPS));
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
SetLastNtError(_SEH2_GetExceptionCode());
|
||||||
|
bResult = FALSE;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
DHPDEV
|
||||||
|
APIENTRY
|
||||||
|
NtGdiGetDhpdev(
|
||||||
|
IN HDEV hdev)
|
||||||
|
{
|
||||||
|
PPDEVOBJ ppdev;
|
||||||
|
DHPDEV dhpdev = NULL;
|
||||||
|
|
||||||
|
/* Check parameter */
|
||||||
|
if (!hdev || (PCHAR)hdev < (PCHAR)MmSystemRangeStart)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Lock PDEV list */
|
||||||
|
EngAcquireSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
/* Walk through the list of PDEVs */
|
||||||
|
for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
|
||||||
|
{
|
||||||
|
/* Compare with the given HDEV */
|
||||||
|
if (ppdev == hdev)
|
||||||
|
{
|
||||||
|
/* Found the PDEV! Get it's dhpdev and break */
|
||||||
|
dhpdev = ppdev->dhpdev;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlock PDEV list */
|
||||||
|
EngReleaseSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
|
return dhpdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
PSIZEL
|
||||||
|
FASTCALL
|
||||||
|
PDEVOBJ_sizl(PPDEVOBJ ppdev, PSIZEL psizl)
|
||||||
|
{
|
||||||
|
if (ppdev->flFlags & PDEV_META_DEVICE)
|
||||||
|
{
|
||||||
|
psizl->cx = ppdev->ulHorzRes;
|
||||||
|
psizl->cy = ppdev->ulVertRes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psizl->cx = ppdev->gdiinfo.ulHorzRes;
|
||||||
|
psizl->cy = ppdev->gdiinfo.ulVertRes;
|
||||||
|
}
|
||||||
|
return psizl;
|
||||||
|
}
|
99
subsystems/win32/win32k/eng/rlecomp.c
Normal file
99
subsystems/win32/win32k/eng/rlecomp.c
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: RLE compression
|
||||||
|
* FILE: subsystems/win32k/eng/rlecomp.c
|
||||||
|
* PROGRAMER: Jason Filby
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <win32k.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
enum Rle_EscapeCodes
|
||||||
|
{
|
||||||
|
RLE_EOL = 0, /* End of line */
|
||||||
|
RLE_END = 1, /* End of bitmap */
|
||||||
|
RLE_DELTA = 2 /* Delta */
|
||||||
|
};
|
||||||
|
|
||||||
|
VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG Format)
|
||||||
|
{
|
||||||
|
INT x = 0;
|
||||||
|
INT y = Size.cy - 1;
|
||||||
|
INT c;
|
||||||
|
INT length;
|
||||||
|
INT width;
|
||||||
|
INT height = Size.cy - 1;
|
||||||
|
BYTE *begin = CompressedBits;
|
||||||
|
BYTE *bits = CompressedBits;
|
||||||
|
BYTE *temp;
|
||||||
|
INT shift = 0;
|
||||||
|
|
||||||
|
if (Format == BMF_4RLE)
|
||||||
|
shift = 1;
|
||||||
|
else if(Format != BMF_8RLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
width = ((Size.cx + shift) >> shift);
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
while (y >= 0)
|
||||||
|
{
|
||||||
|
length = (*bits++) >> shift;
|
||||||
|
if (length)
|
||||||
|
{
|
||||||
|
c = *bits++;
|
||||||
|
while (length--)
|
||||||
|
{
|
||||||
|
if (x >= width) break;
|
||||||
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
||||||
|
x++;
|
||||||
|
*temp = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = *bits++;
|
||||||
|
switch (length)
|
||||||
|
{
|
||||||
|
case RLE_EOL:
|
||||||
|
x = 0;
|
||||||
|
y--;
|
||||||
|
break;
|
||||||
|
case RLE_END:
|
||||||
|
_SEH2_YIELD(return);
|
||||||
|
case RLE_DELTA:
|
||||||
|
x += (*bits++) >> shift;
|
||||||
|
y -= (*bits++) >> shift;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
length = length >> shift;
|
||||||
|
while (length--)
|
||||||
|
{
|
||||||
|
c = *bits++;
|
||||||
|
if (x < width)
|
||||||
|
{
|
||||||
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
||||||
|
x++;
|
||||||
|
*temp = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((bits - begin) & 1)
|
||||||
|
{
|
||||||
|
bits++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
DPRINT1("Decoding error\n");
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
|
@ -69,6 +69,19 @@ EngReleaseSemaphore ( IN HSEMAPHORE hsem )
|
||||||
IntGdiReleaseSemaphore ( hsem );
|
IntGdiReleaseSemaphore ( hsem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
EngAcquireSemaphoreShared(
|
||||||
|
IN HSEMAPHORE hsem)
|
||||||
|
{
|
||||||
|
PTHREADINFO pti;
|
||||||
|
|
||||||
|
ASSERT(hsem);
|
||||||
|
ExEnterCriticalRegionAndAcquireResourceShared((PERESOURCE)hsem);
|
||||||
|
pti = PsGetThreadWin32Thread(PsGetCurrentThread());
|
||||||
|
if (pti) ++pti->dwEngAcquireCount;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -462,25 +462,16 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
|
|
||||||
/* No success yet */
|
/* No success yet */
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
|
||||||
MouseSafetyOnDrawStart(psoDest, OutputRect.left, OutputRect.top,
|
|
||||||
OutputRect.right, OutputRect.bottom);
|
|
||||||
|
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
||||||
if (psoSource != psoDest)
|
|
||||||
{
|
|
||||||
SURFACE_LockBitmapBits(psurfSource);
|
|
||||||
}
|
|
||||||
MouseSafetyOnDrawStart(psoSource, InputRect.left, InputRect.top,
|
|
||||||
InputRect.right, InputRect.bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare color adjustment */
|
/* Prepare color adjustment */
|
||||||
|
|
||||||
/* Call the driver's DrvStretchBlt if available */
|
/* Call the driver's DrvStretchBlt if available */
|
||||||
if (psurfDest->flHooks & HOOK_STRETCHBLTROP)
|
if (psurfDest->flags & HOOK_STRETCHBLTROP)
|
||||||
{
|
{
|
||||||
/* Drv->StretchBltROP (look at http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */
|
/* Drv->StretchBltROP (look at http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */
|
||||||
ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
|
ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
|
||||||
|
@ -514,17 +505,6 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
ROP);
|
ROP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
MouseSafetyOnDrawEnd(psoSource);
|
|
||||||
if (psoSource != psoDest)
|
|
||||||
{
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -76,7 +76,7 @@ EngTransparentBlt(SURFOBJ *psoDest,
|
||||||
OutputRect.top = DestRect->bottom;
|
OutputRect.top = DestRect->bottom;
|
||||||
OutputRect.bottom = DestRect->top;
|
OutputRect.bottom = DestRect->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Clip)
|
if(Clip)
|
||||||
{
|
{
|
||||||
if(OutputRect.left < Clip->rclBounds.left)
|
if(OutputRect.left < Clip->rclBounds.left)
|
||||||
|
@ -284,17 +284,7 @@ IntEngTransparentBlt(SURFOBJ *psoDest,
|
||||||
OutputRect = InputClippedRect;
|
OutputRect = InputClippedRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(psoSource != psoDest)
|
if(psurfDest->flags & HOOK_TRANSPARENTBLT)
|
||||||
{
|
|
||||||
SURFACE_LockBitmapBits(psurfSource);
|
|
||||||
MouseSafetyOnDrawStart(psoSource, InputRect.left, InputRect.top,
|
|
||||||
InputRect.right, InputRect.bottom);
|
|
||||||
}
|
|
||||||
SURFACE_LockBitmapBits(psurfDest);
|
|
||||||
MouseSafetyOnDrawStart(psoDest, OutputRect.left, OutputRect.top,
|
|
||||||
OutputRect.right, OutputRect.bottom);
|
|
||||||
|
|
||||||
if(psurfDest->flHooks & HOOK_TRANSPARENTBLT)
|
|
||||||
{
|
{
|
||||||
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
|
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
|
||||||
psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
|
psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
|
||||||
|
@ -309,14 +299,6 @@ IntEngTransparentBlt(SURFOBJ *psoDest,
|
||||||
&OutputRect, &InputRect, iTransColor, Reserved);
|
&OutputRect, &InputRect, iTransColor, Reserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(psoDest);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfDest);
|
|
||||||
if(psoSource != psoDest)
|
|
||||||
{
|
|
||||||
MouseSafetyOnDrawEnd(psoSource);
|
|
||||||
SURFACE_UnlockBitmapBits(psurfSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ EXLATEOBJ_iXlateRGBtoBGR(PEXLATEOBJ pxlo, ULONG iColor)
|
||||||
{
|
{
|
||||||
ULONG iNewColor;
|
ULONG iNewColor;
|
||||||
|
|
||||||
/* Copy green and alpha */
|
/* Copy green */
|
||||||
iNewColor = iColor & 0xff00ff00;
|
iNewColor = iColor & 0xff00ff00;
|
||||||
|
|
||||||
/* Mask red and blue */
|
/* Mask red and blue */
|
||||||
|
@ -362,19 +362,19 @@ EXLATEOBJ_vInitialize(
|
||||||
EXLATEOBJ_vInitTrivial(pexlo);
|
EXLATEOBJ_vInitTrivial(pexlo);
|
||||||
|
|
||||||
if (ppalDst == ppalSrc || !ppalSrc || !ppalDst ||
|
if (ppalDst == ppalSrc || !ppalSrc || !ppalDst ||
|
||||||
((ppalDst->Mode == PAL_RGB || ppalDst->Mode == PAL_BGR) &&
|
((ppalDst->flFlags == PAL_RGB || ppalDst->flFlags == PAL_BGR) &&
|
||||||
ppalDst->Mode == ppalSrc->Mode))
|
ppalDst->flFlags == ppalSrc->flFlags))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pexlo->ppalSrc = ppalSrc;
|
pexlo->ppalSrc = ppalSrc;
|
||||||
pexlo->ppalDst = ppalDst;
|
pexlo->ppalDst = ppalDst;
|
||||||
pexlo->xlo.iSrcType = ppalSrc->Mode;
|
pexlo->xlo.iSrcType = ppalSrc->flFlags;
|
||||||
pexlo->xlo.iDstType = ppalDst->Mode;
|
pexlo->xlo.iDstType = ppalDst->flFlags;
|
||||||
|
|
||||||
/* Chack if both of the pallettes are indexed */
|
/* Chack if both of the pallettes are indexed */
|
||||||
if (!(ppalSrc->Mode & PAL_INDEXED) || !(ppalDst->Mode & PAL_INDEXED))
|
if (!(ppalSrc->flFlags & PAL_INDEXED) || !(ppalDst->flFlags & PAL_INDEXED))
|
||||||
{
|
{
|
||||||
/* At least one palette is not indexed, calculate shifts/masks */
|
/* At least one palette is not indexed, calculate shifts/masks */
|
||||||
ULONG aulMasksSrc[3], aulMasksDst[3];
|
ULONG aulMasksSrc[3], aulMasksDst[3];
|
||||||
|
@ -391,10 +391,10 @@ EXLATEOBJ_vInitialize(
|
||||||
pexlo->ulBlueShift = CalculateShift(aulMasksSrc[2], aulMasksDst[2]);
|
pexlo->ulBlueShift = CalculateShift(aulMasksSrc[2], aulMasksDst[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppalSrc->Mode & PAL_MONOCHROME)
|
if (ppalSrc->flFlags & PAL_MONOCHROME)
|
||||||
{
|
{
|
||||||
/* This is a monochrome palette */
|
/* This is a monochrome palette */
|
||||||
if (!(ppalDst->Mode & PAL_MONOCHROME))
|
if (!(ppalDst->flFlags & PAL_MONOCHROME))
|
||||||
{
|
{
|
||||||
/* Mono to color, use the dest DC's fore and back color */
|
/* Mono to color, use the dest DC's fore and back color */
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
|
||||||
|
@ -406,28 +406,28 @@ EXLATEOBJ_vInitialize(
|
||||||
PALETTE_ulGetNearestIndex(ppalDst, crDstBackColor);
|
PALETTE_ulGetNearestIndex(ppalDst, crDstBackColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ppalDst->Mode & PAL_MONOCHROME)
|
else if (ppalDst->flFlags & PAL_MONOCHROME)
|
||||||
{
|
{
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateToMono;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateToMono;
|
||||||
pexlo->xlo.flXlate |= XO_TO_MONO;
|
pexlo->xlo.flXlate |= XO_TO_MONO;
|
||||||
pexlo->xlo.cEntries = 1;
|
pexlo->xlo.cEntries = 1;
|
||||||
|
|
||||||
if (ppalSrc->Mode & PAL_INDEXED)
|
if (ppalSrc->flFlags & PAL_INDEXED)
|
||||||
{
|
{
|
||||||
pexlo->aulXlate[0] =
|
pexlo->aulXlate[0] =
|
||||||
PALETTE_ulGetNearestPaletteIndex(ppalSrc, crSrcBackColor);
|
PALETTE_ulGetNearestPaletteIndex(ppalSrc, crSrcBackColor);
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_BGR)
|
else if (ppalSrc->flFlags & PAL_BGR)
|
||||||
{
|
{
|
||||||
pexlo->aulXlate[0] = crSrcBackColor;
|
pexlo->aulXlate[0] = crSrcBackColor;
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_RGB)
|
else if (ppalSrc->flFlags & PAL_RGB)
|
||||||
{
|
{
|
||||||
pexlo->aulXlate[0] = RGB(GetBValue(crSrcBackColor),
|
pexlo->aulXlate[0] = RGB(GetBValue(crSrcBackColor),
|
||||||
GetGValue(crSrcBackColor),
|
GetGValue(crSrcBackColor),
|
||||||
GetRValue(crSrcBackColor));
|
GetRValue(crSrcBackColor));
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_BITFIELDS)
|
else if (ppalSrc->flFlags & PAL_BITFIELDS)
|
||||||
{
|
{
|
||||||
PALETTE_vGetBitMasks(ppalSrc, &pexlo->ulRedMask);
|
PALETTE_vGetBitMasks(ppalSrc, &pexlo->ulRedMask);
|
||||||
pexlo->ulRedShift = CalculateShift(0xFF, pexlo->ulRedMask);
|
pexlo->ulRedShift = CalculateShift(0xFF, pexlo->ulRedMask);
|
||||||
|
@ -437,7 +437,7 @@ EXLATEOBJ_vInitialize(
|
||||||
pexlo->aulXlate[0] = EXLATEOBJ_iXlateShiftAndMask(pexlo, crSrcBackColor);
|
pexlo->aulXlate[0] = EXLATEOBJ_iXlateShiftAndMask(pexlo, crSrcBackColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_INDEXED)
|
else if (ppalSrc->flFlags & PAL_INDEXED)
|
||||||
{
|
{
|
||||||
cEntries = ppalSrc->NumColors;
|
cEntries = ppalSrc->NumColors;
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ EXLATEOBJ_vInitialize(
|
||||||
pexlo->xlo.cEntries = cEntries;
|
pexlo->xlo.cEntries = cEntries;
|
||||||
|
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
{
|
{
|
||||||
pexlo->xlo.flXlate |= XO_TABLE;
|
pexlo->xlo.flXlate |= XO_TABLE;
|
||||||
|
|
||||||
|
@ -504,78 +504,78 @@ EXLATEOBJ_vInitialize(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_RGB)
|
else if (ppalSrc->flFlags & PAL_RGB)
|
||||||
{
|
{
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoPal;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoPal;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BGR)
|
else if (ppalDst->flFlags & PAL_BGR)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_555)
|
else if (ppalDst->flFlags & PAL_RGB16_555)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto555;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto555;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_565)
|
else if (ppalDst->flFlags & PAL_RGB16_565)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto565;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto565;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BITFIELDS)
|
else if (ppalDst->flFlags & PAL_BITFIELDS)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_BGR)
|
else if (ppalSrc->flFlags & PAL_BGR)
|
||||||
{
|
{
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB)
|
else if (ppalDst->flFlags & PAL_RGB)
|
||||||
/* The inverse function works the same */
|
/* The inverse function works the same */
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_555)
|
else if (ppalDst->flFlags & PAL_RGB16_555)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto555;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto555;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_565)
|
else if (ppalDst->flFlags & PAL_RGB16_565)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto565;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto565;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BITFIELDS)
|
else if (ppalDst->flFlags & PAL_BITFIELDS)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_RGB16_555)
|
else if (ppalSrc->flFlags & PAL_RGB16_555)
|
||||||
{
|
{
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate555toPal;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate555toPal;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB)
|
else if (ppalDst->flFlags & PAL_RGB)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate555toRGB;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate555toRGB;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BGR)
|
else if (ppalDst->flFlags & PAL_BGR)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate555toBGR;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate555toBGR;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_565)
|
else if (ppalDst->flFlags & PAL_RGB16_565)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate555to565;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate555to565;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BITFIELDS)
|
else if (ppalDst->flFlags & PAL_BITFIELDS)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_RGB16_565)
|
else if (ppalSrc->flFlags & PAL_RGB16_565)
|
||||||
{
|
{
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate565toPal;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate565toPal;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB)
|
else if (ppalDst->flFlags & PAL_RGB)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate565toRGB;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate565toRGB;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BGR)
|
else if (ppalDst->flFlags & PAL_BGR)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate565toBGR;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate565toBGR;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_RGB16_555)
|
else if (ppalDst->flFlags & PAL_RGB16_555)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlate565to555;
|
pexlo->pfnXlate = EXLATEOBJ_iXlate565to555;
|
||||||
|
|
||||||
else if (ppalDst->Mode & PAL_BITFIELDS)
|
else if (ppalDst->flFlags & PAL_BITFIELDS)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
||||||
}
|
}
|
||||||
else if (ppalSrc->Mode & PAL_BITFIELDS)
|
else if (ppalSrc->flFlags & PAL_BITFIELDS)
|
||||||
{
|
{
|
||||||
if (ppalDst->Mode & PAL_INDEXED)
|
if (ppalDst->flFlags & PAL_INDEXED)
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
|
||||||
else
|
else
|
||||||
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
|
||||||
|
@ -603,157 +603,24 @@ EXLATEOBJ_vInitXlateFromDCs(
|
||||||
PDC pdcDst)
|
PDC pdcDst)
|
||||||
{
|
{
|
||||||
PSURFACE psurfDst, psurfSrc;
|
PSURFACE psurfDst, psurfSrc;
|
||||||
HPALETTE hpalSrc, hpalDst;
|
|
||||||
PPALETTE ppalSrc, ppalDst, ppalDstDc;
|
|
||||||
|
|
||||||
DPRINT("Enter EXLATEOBJ_vInitXlateFromDCs\n");
|
|
||||||
|
|
||||||
/* Do basic init */
|
|
||||||
EXLATEOBJ_vInitTrivial(pexlo);
|
|
||||||
|
|
||||||
psurfDst = pdcDst->dclevel.pSurface;
|
psurfDst = pdcDst->dclevel.pSurface;
|
||||||
psurfSrc = pdcSrc->dclevel.pSurface;
|
psurfSrc = pdcSrc->dclevel.pSurface;
|
||||||
|
|
||||||
|
/* Check for trivial color translation */
|
||||||
if (psurfDst == psurfSrc)
|
if (psurfDst == psurfSrc)
|
||||||
{
|
{
|
||||||
|
EXLATEOBJ_vInitTrivial(pexlo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hpalSrc = psurfSrc->hDIBPalette;
|
/* Normal initialisation. No surface means DEFAULT_BITMAP */
|
||||||
if (!hpalSrc)
|
EXLATEOBJ_vInitialize(pexlo,
|
||||||
hpalSrc = pPrimarySurface->devinfo.hpalDefault;
|
psurfSrc ? psurfSrc->ppal : &gpalMono,
|
||||||
|
psurfDst ? psurfDst->ppal : &gpalMono,
|
||||||
ppalSrc = PALETTE_ShareLockPalette(hpalSrc);
|
pdcSrc->pdcattr->crBackgroundClr,
|
||||||
if (!ppalSrc)
|
pdcDst->pdcattr->crBackgroundClr,
|
||||||
return;
|
pdcDst->pdcattr->crForegroundClr);
|
||||||
|
|
||||||
hpalDst = psurfDst->hDIBPalette;
|
|
||||||
if (!hpalDst) hpalDst = pPrimarySurface->devinfo.hpalDefault;
|
|
||||||
|
|
||||||
ppalDst = PALETTE_ShareLockPalette(hpalDst);
|
|
||||||
if (!ppalDst)
|
|
||||||
{
|
|
||||||
PALETTE_ShareUnlockPalette(ppalSrc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ppalDstDc = pdcDst->dclevel.ppal;
|
|
||||||
ASSERT(ppalDstDc);
|
|
||||||
|
|
||||||
/* KB41464 details how to convert between mono and color */
|
|
||||||
if (psurfDst->SurfObj.iBitmapFormat == BMF_1BPP)
|
|
||||||
{
|
|
||||||
if (psurfSrc->SurfObj.iBitmapFormat != BMF_1BPP)
|
|
||||||
{
|
|
||||||
// HACK!! FIXME: 1bpp DDBs should have gpalMono already!
|
|
||||||
EXLATEOBJ_vInitialize(pexlo,
|
|
||||||
ppalSrc,
|
|
||||||
&gpalMono,
|
|
||||||
pdcSrc->pdcattr->crBackgroundClr,
|
|
||||||
pdcDst->pdcattr->crBackgroundClr,
|
|
||||||
pdcDst->pdcattr->crForegroundClr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (psurfSrc->SurfObj.iBitmapFormat == BMF_1BPP && !psurfSrc->hSecure)
|
|
||||||
{
|
|
||||||
// HACK!! FIXME: 1bpp DDBs should have gpalMono already!
|
|
||||||
EXLATEOBJ_vInitialize(pexlo,
|
|
||||||
&gpalMono,
|
|
||||||
ppalDst,
|
|
||||||
0,
|
|
||||||
pdcDst->pdcattr->crBackgroundClr,
|
|
||||||
pdcDst->pdcattr->crForegroundClr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EXLATEOBJ_vInitialize(pexlo, ppalSrc, ppalDst, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
PALETTE_ShareUnlockPalette(ppalDst);
|
|
||||||
PALETTE_ShareUnlockPalette(ppalSrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
EXLATEOBJ_vInitBrushXlate(
|
|
||||||
PEXLATEOBJ pexlo,
|
|
||||||
BRUSH *pbrush,
|
|
||||||
SURFACE *psurfDst,
|
|
||||||
COLORREF crForegroundClr,
|
|
||||||
COLORREF crBackgroundClr)
|
|
||||||
{
|
|
||||||
HPALETTE hpalDst = NULL;
|
|
||||||
PPALETTE ppalDst, ppalPattern;
|
|
||||||
SURFACE *psurfPattern;
|
|
||||||
|
|
||||||
ASSERT(pexlo);
|
|
||||||
ASSERT(pbrush);
|
|
||||||
ASSERT(psurfDst);
|
|
||||||
ASSERT(!(pbrush->flAttrs & (GDIBRUSH_IS_SOLID | GDIBRUSH_IS_NULL)));
|
|
||||||
|
|
||||||
EXLATEOBJ_vInitTrivial(pexlo);
|
|
||||||
|
|
||||||
hpalDst = psurfDst->hDIBPalette;
|
|
||||||
if (!hpalDst) hpalDst = pPrimarySurface->devinfo.hpalDefault;
|
|
||||||
ppalDst = PALETTE_ShareLockPalette(hpalDst);
|
|
||||||
if (!ppalDst)
|
|
||||||
{
|
|
||||||
DPRINT1("No ppalDst!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
psurfPattern = SURFACE_ShareLockSurface(pbrush->hbmPattern);
|
|
||||||
if (!psurfPattern)
|
|
||||||
{
|
|
||||||
PALETTE_ShareUnlockPalette(ppalDst);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (psurfDst->SurfObj.iBitmapFormat == BMF_1BPP)
|
|
||||||
{
|
|
||||||
if (psurfSrc->SurfObj.iBitmapFormat != BMF_1BPP)
|
|
||||||
{
|
|
||||||
// HACK!! FIXME: 1bpp DDBs should have gpalMono already!
|
|
||||||
EXLATEOBJ_vInitialize(pexlo,
|
|
||||||
ppalSrc,
|
|
||||||
&gpalMono,
|
|
||||||
0,
|
|
||||||
crBackgroundClr,
|
|
||||||
crForegroundClr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (psurfPattern->SurfObj.iBitmapFormat == BMF_1BPP &&
|
|
||||||
!(pbrush->flAttrs & GDIBRUSH_IS_DIB))
|
|
||||||
{
|
|
||||||
/* Special case: 1 bpp pattern, not a DIB brush. */
|
|
||||||
if (psurfDst->SurfObj.iBitmapFormat != BMF_1BPP)
|
|
||||||
{
|
|
||||||
// HACK!! FIXME: 1bpp DDBs should have gpalMono already!
|
|
||||||
EXLATEOBJ_vInitialize(pexlo,
|
|
||||||
&gpalMono,
|
|
||||||
ppalDst,
|
|
||||||
0,
|
|
||||||
crBackgroundClr,
|
|
||||||
crForegroundClr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Default: use the patterns' palette */
|
|
||||||
ppalPattern = PALETTE_LockPalette(psurfPattern->hDIBPalette);
|
|
||||||
if (ppalPattern)
|
|
||||||
{
|
|
||||||
EXLATEOBJ_vInitialize(pexlo, &gpalRGB, ppalDst, 0, 0, 0);
|
|
||||||
PALETTE_UnlockPalette(ppalPattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PALETTE_ShareUnlockPalette(ppalDst);
|
|
||||||
SURFACE_ShareUnlockSurface(psurfPattern);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -827,9 +694,9 @@ XLATEOBJ_cGetPalette(XLATEOBJ *pxlo, ULONG iPal, ULONG cPal, ULONG *pPalOut)
|
||||||
/* Verify palette type match */
|
/* Verify palette type match */
|
||||||
if (!ppal ||
|
if (!ppal ||
|
||||||
((iPal == XO_SRCPALETTE || iPal == XO_DESTPALETTE)
|
((iPal == XO_SRCPALETTE || iPal == XO_DESTPALETTE)
|
||||||
&& !(ppal->Mode & PAL_INDEXED)) ||
|
&& !(ppal->flFlags & PAL_INDEXED)) ||
|
||||||
((iPal == XO_SRCBITFIELDS || iPal == XO_DESTBITFIELDS)
|
((iPal == XO_SRCBITFIELDS || iPal == XO_DESTBITFIELDS)
|
||||||
&& !(ppal->Mode & PAL_BITFIELDS)))
|
&& !(ppal->flFlags & PAL_BITFIELDS)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -840,7 +707,7 @@ XLATEOBJ_cGetPalette(XLATEOBJ *pxlo, ULONG iPal, ULONG cPal, ULONG *pPalOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the values into the buffer */
|
/* Copy the values into the buffer */
|
||||||
if (ppal->Mode & PAL_INDEXED)
|
if (ppal->flFlags & PAL_INDEXED)
|
||||||
{
|
{
|
||||||
cPal = min(cPal, ppal->NumColors);
|
cPal = min(cPal, ppal->NumColors);
|
||||||
for (i = 0; i < cPal; i++)
|
for (i = 0; i < cPal; i++)
|
||||||
|
|
|
@ -2,11 +2,47 @@
|
||||||
|
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
|
|
||||||
INT FASTCALL DIB_GetDIBWidthBytes (INT width, INT depth);
|
typedef struct tagBITMAPV5INFO
|
||||||
int APIENTRY DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
{
|
||||||
INT FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
BITMAPV5HEADER bmiHeader;
|
||||||
|
RGBQUAD bmiColors[256];
|
||||||
|
} BITMAPV5INFO, *PBITMAPV5INFO;
|
||||||
|
|
||||||
INT APIENTRY BITMAP_GetObject(SURFACE * bmp, INT count, LPVOID buffer);
|
INT APIENTRY BITMAP_GetObject(SURFACE * bmp, INT count, LPVOID buffer);
|
||||||
HBITMAP FASTCALL IntCreateBitmap(IN SIZEL Size, IN LONG Width, IN ULONG Format, IN ULONG Flags, IN PVOID Bits);
|
HBITMAP FASTCALL IntCreateBitmap(IN SIZEL Size, IN LONG Width, IN ULONG Format, IN ULONG Flags, IN PVOID Bits);
|
||||||
HBITMAP FASTCALL BITMAP_CopyBitmap (HBITMAP hBitmap);
|
HBITMAP FASTCALL BITMAP_CopyBitmap (HBITMAP hBitmap);
|
||||||
UINT FASTCALL BITMAP_GetRealBitsPixel(UINT nBitsPixel);
|
UINT FASTCALL BITMAP_GetRealBitsPixel(UINT nBitsPixel);
|
||||||
INT FASTCALL BITMAP_GetWidthBytes (INT bmWidth, INT bpp);
|
|
||||||
|
HBITMAP
|
||||||
|
APIENTRY
|
||||||
|
GreCreateBitmap(
|
||||||
|
IN INT nWidth,
|
||||||
|
IN INT nHeight,
|
||||||
|
IN UINT cPlanes,
|
||||||
|
IN UINT cBitsPixel,
|
||||||
|
IN OPTIONAL PVOID pvBits);
|
||||||
|
|
||||||
|
HBITMAP
|
||||||
|
APIENTRY
|
||||||
|
GreCreateBitmapEx(
|
||||||
|
IN INT nWidth,
|
||||||
|
IN INT nHeight,
|
||||||
|
IN ULONG cjWidthBytes,
|
||||||
|
IN ULONG iFormat,
|
||||||
|
IN USHORT fjBitmap,
|
||||||
|
IN ULONG cjBits,
|
||||||
|
IN OPTIONAL PVOID pvBits,
|
||||||
|
IN FLONG flags);
|
||||||
|
|
||||||
|
HBITMAP
|
||||||
|
FASTCALL
|
||||||
|
GreCreateDIBitmapInternal(
|
||||||
|
IN HDC hDc,
|
||||||
|
IN INT cx,
|
||||||
|
IN INT cy,
|
||||||
|
IN DWORD fInit,
|
||||||
|
IN OPTIONAL LPBYTE pjInit,
|
||||||
|
IN OPTIONAL PBITMAPINFO pbmi,
|
||||||
|
IN DWORD iUsage,
|
||||||
|
IN FLONG fl,
|
||||||
|
IN HANDLE hcmXform);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#ifndef __WIN32K_DC_H
|
||||||
|
#define __WIN32K_DC_H
|
||||||
|
|
||||||
typedef struct _DC *PDC;
|
typedef struct _DC *PDC;
|
||||||
|
|
||||||
|
@ -22,6 +23,30 @@ typedef struct _DC *PDC;
|
||||||
/* fl */
|
/* fl */
|
||||||
#define DC_FL_PAL_BACK 1
|
#define DC_FL_PAL_BACK 1
|
||||||
|
|
||||||
|
#define DC_DISPLAY 1
|
||||||
|
#define DC_DIRECT 2
|
||||||
|
#define DC_CANCELED 4
|
||||||
|
#define DC_PERMANANT 0x08
|
||||||
|
#define DC_DIRTY_RAO 0x10
|
||||||
|
#define DC_ACCUM_WMGR 0x20
|
||||||
|
#define DC_ACCUM_APP 0x40
|
||||||
|
#define DC_RESET 0x80
|
||||||
|
#define DC_SYNCHRONIZEACCESS 0x100
|
||||||
|
#define DC_EPSPRINTINGESCAPE 0x200
|
||||||
|
#define DC_TEMPINFODC 0x400
|
||||||
|
#define DC_FULLSCREEN 0x800
|
||||||
|
#define DC_IN_CLONEPDEV 0x1000
|
||||||
|
#define DC_REDIRECTION 0x2000
|
||||||
|
#define DC_SHAREACCESS 0x4000
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DCTYPE_DIRECT = 0,
|
||||||
|
DCTYPE_MEMORY = 1,
|
||||||
|
DCTYPE_INFO = 2,
|
||||||
|
} DCTYPE;
|
||||||
|
|
||||||
|
|
||||||
/* Type definitions ***********************************************************/
|
/* Type definitions ***********************************************************/
|
||||||
|
|
||||||
typedef struct _ROS_DC_INFO
|
typedef struct _ROS_DC_INFO
|
||||||
|
@ -29,7 +54,7 @@ typedef struct _ROS_DC_INFO
|
||||||
HRGN hClipRgn; /* Clip region (may be 0) */
|
HRGN hClipRgn; /* Clip region (may be 0) */
|
||||||
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
|
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
|
||||||
|
|
||||||
CLIPOBJ *CombinedClip; /* Use XCLIPOBJ in DC. */
|
CLIPOBJ *CombinedClip;
|
||||||
|
|
||||||
UNICODE_STRING DriverName;
|
UNICODE_STRING DriverName;
|
||||||
|
|
||||||
|
@ -136,13 +161,12 @@ extern PDC defaultDCstate;
|
||||||
|
|
||||||
NTSTATUS FASTCALL InitDcImpl(VOID);
|
NTSTATUS FASTCALL InitDcImpl(VOID);
|
||||||
PPDEVOBJ FASTCALL IntEnumHDev(VOID);
|
PPDEVOBJ FASTCALL IntEnumHDev(VOID);
|
||||||
HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
|
PDC NTAPI DC_AllocDcWithHandle();
|
||||||
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
VOID FASTCALL DC_InitDC(HDC DCToInit);
|
||||||
HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver);
|
|
||||||
VOID FASTCALL DC_AllocateDcAttr(HDC);
|
VOID FASTCALL DC_AllocateDcAttr(HDC);
|
||||||
VOID FASTCALL DC_FreeDcAttr(HDC);
|
VOID FASTCALL DC_FreeDcAttr(HDC);
|
||||||
BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
|
BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
|
||||||
BOOL FASTCALL DC_SetOwnership(HDC DC, PEPROCESS Owner);
|
BOOL FASTCALL DC_SetOwnership(HDC hDC, PEPROCESS Owner);
|
||||||
VOID FASTCALL DC_LockDisplay(HDC);
|
VOID FASTCALL DC_LockDisplay(HDC);
|
||||||
VOID FASTCALL DC_UnlockDisplay(HDC);
|
VOID FASTCALL DC_UnlockDisplay(HDC);
|
||||||
BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL);
|
BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL);
|
||||||
|
@ -155,10 +179,16 @@ VOID FASTCALL DC_vUpdateFillBrush(PDC pdc);
|
||||||
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc);
|
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc);
|
||||||
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc);
|
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc);
|
||||||
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc);
|
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc);
|
||||||
|
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2);
|
||||||
|
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdc1, RECT rc1, PDC pdc2, RECT rc2);
|
||||||
|
|
||||||
|
VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel);
|
||||||
|
|
||||||
BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC);
|
BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC);
|
||||||
BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC);
|
BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC);
|
||||||
VOID FASTCALL DCU_SetDcUndeletable(HDC);
|
VOID FASTCALL DCU_SetDcUndeletable(HDC);
|
||||||
|
VOID NTAPI DC_vFreeDcAttr(PDC pdc);
|
||||||
|
VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev);
|
||||||
|
|
||||||
COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF Color);
|
COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF Color);
|
||||||
INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode);
|
INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode);
|
||||||
|
@ -174,12 +204,9 @@ VOID FASTCALL IntGdiUnreferencePdev(PPDEVOBJ pPDev, DWORD CleanUpType);
|
||||||
HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
|
HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
|
||||||
BOOL FASTCALL IntGdiCleanDC(HDC hDC);
|
BOOL FASTCALL IntGdiCleanDC(HDC hDC);
|
||||||
VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
|
VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
|
||||||
INT FASTCALL IntGdiGetDeviceCaps(PDC,INT);
|
|
||||||
BOOL FASTCALL MakeInfoDC(PDC,BOOL);
|
BOOL FASTCALL MakeInfoDC(PDC,BOOL);
|
||||||
BOOL FASTCALL IntSetDefaultRegion(PDC);
|
BOOL FASTCALL IntSetDefaultRegion(PDC);
|
||||||
|
|
||||||
extern PPDEVOBJ pPrimarySurface;
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
|
DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
|
||||||
|
@ -228,5 +255,6 @@ DC_vSelectPalette(PDC pdc, PPALETTE ppal)
|
||||||
pdc->dclevel.ppal = ppal;
|
pdc->dclevel.ppal = ppal;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL IntPrepareDriverIfNeeded(VOID);
|
extern PBRUSH pbrDefaultBrush ;
|
||||||
extern PDEVOBJ PrimarySurface;
|
|
||||||
|
#endif /* not __WIN32K_DC_H */
|
||||||
|
|
57
subsystems/win32/win32k/include/device.h
Normal file
57
subsystems/win32/win32k/include/device.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
//#define _PDEVOBJ _PDEVOBJ2
|
||||||
|
//#define PDEVOBJ PDEVOBJ2
|
||||||
|
//#define PPDEVOBJ PPDEVOBJ2
|
||||||
|
|
||||||
|
//typedef struct _PDEVOBJ *PPDEVOBJ;
|
||||||
|
|
||||||
|
#define TAG_GDEV 'gdev'
|
||||||
|
|
||||||
|
VOID
|
||||||
|
APIENTRY
|
||||||
|
EngFileWrite(
|
||||||
|
IN PFILE_OBJECT pFileObject,
|
||||||
|
IN PVOID lpBuffer,
|
||||||
|
IN SIZE_T nLength,
|
||||||
|
IN PSIZE_T lpBytesWritten);
|
||||||
|
|
||||||
|
PGRAPHICS_DEVICE
|
||||||
|
NTAPI
|
||||||
|
EngpFindGraphicsDevice(
|
||||||
|
PUNICODE_STRING pustrDevice,
|
||||||
|
DWORD iDevNum,
|
||||||
|
DWORD dwFlags);
|
||||||
|
|
||||||
|
PGRAPHICS_DEVICE
|
||||||
|
NTAPI
|
||||||
|
EngpRegisterGraphicsDevice(
|
||||||
|
PUNICODE_STRING pustrDeviceName,
|
||||||
|
PUNICODE_STRING pustrDiplayDrivers,
|
||||||
|
PUNICODE_STRING pustrDescription,
|
||||||
|
PDEVMODEW pdmDefault);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitDeviceImpl();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
FASTCALL
|
||||||
|
DC_AllocDcAttr(PDC pdc);
|
||||||
|
|
||||||
|
//#define KeRosDumpStackFrames(Frames, Count) KdSystemDebugControl(TAG('R', 'o', 's', 'D'), (PVOID)Frames, Count, NULL, 0, NULL, KernelMode)
|
||||||
|
NTSYSAPI ULONG APIENTRY RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_bSwitchMode(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVMODEW pdm);
|
||||||
|
|
||||||
|
PDEVMODEW
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_pdmMatchDevMode(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVMODEW pdm);
|
||||||
|
|
||||||
|
extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
|
||||||
|
extern PGRAPHICS_DEVICE gpVgaGraphicsDevice;
|
|
@ -5,15 +5,17 @@
|
||||||
INT FASTCALL
|
INT FASTCALL
|
||||||
DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
|
||||||
HBITMAP APIENTRY
|
HBITMAP APIENTRY
|
||||||
DIB_CreateDIBSection (PDC dc, PBITMAPINFO bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
DIB_CreateDIBSection (PDC dc, CONST BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
|
||||||
INT APIENTRY
|
int FASTCALL
|
||||||
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, PLONG width, PLONG height, PWORD planes, PWORD bpp, PLONG compr, PLONG size );
|
DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
|
||||||
|
LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size );
|
||||||
INT APIENTRY
|
INT APIENTRY
|
||||||
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
DIB_GetDIBImageBytes (INT width, INT height, INT depth);
|
||||||
INT FASTCALL
|
HPALETTE FASTCALL
|
||||||
DIB_GetDIBWidthBytes (INT width, INT depth);
|
DIB_MapPaletteColors(PPALETTE ppal, CONST BITMAPINFO* lpbmi);
|
||||||
RGBQUAD * FASTCALL
|
|
||||||
DIB_MapPaletteColors(PDC dc, CONST BITMAPINFO* lpbmi);
|
|
||||||
|
|
||||||
HPALETTE FASTCALL
|
HPALETTE FASTCALL
|
||||||
BuildDIBPalette (CONST BITMAPINFO *bmi, PINT paletteType);
|
BuildDIBPalette (CONST BITMAPINFO *bmi);
|
||||||
|
|
||||||
|
BITMAPINFO* FASTCALL DIB_ConvertBitmapInfo(CONST BITMAPINFO* bmi, DWORD Usage);
|
||||||
|
VOID FASTCALL DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig);
|
|
@ -21,3 +21,19 @@ IntEngWindowChanged(
|
||||||
VOID FASTCALL IntGdiAcquireSemaphore ( HSEMAPHORE hsem );
|
VOID FASTCALL IntGdiAcquireSemaphore ( HSEMAPHORE hsem );
|
||||||
VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem );
|
VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem );
|
||||||
ULONGLONG APIENTRY EngGetTickCount(VOID);
|
ULONGLONG APIENTRY EngGetTickCount(VOID);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
APIENTRY
|
||||||
|
EngFreeSectionMem(
|
||||||
|
IN PVOID pvSection OPTIONAL,
|
||||||
|
IN PVOID pvMappedBase OPTIONAL);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
APIENTRY
|
||||||
|
EngAllocSectionMem(
|
||||||
|
OUT PVOID *ppvSection,
|
||||||
|
IN ULONG fl,
|
||||||
|
IN SIZE_T cjSize,
|
||||||
|
IN ULONG ulTag);
|
||||||
|
|
||||||
|
VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG iFormat);
|
||||||
|
|
|
@ -71,6 +71,7 @@ VOID INTERNAL_CALL GDIOBJ_FreeObj (POBJ pObj, UCHAR ObjectType);
|
||||||
BOOL INTERNAL_CALL GDIOBJ_FreeObjByHandle (HGDIOBJ hObj, DWORD ObjectType);
|
BOOL INTERNAL_CALL GDIOBJ_FreeObjByHandle (HGDIOBJ hObj, DWORD ObjectType);
|
||||||
PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType);
|
PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType);
|
||||||
PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType);
|
PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType);
|
||||||
|
VOID INTERNAL_CALL GDIOBJ_LockMultipleObjs(ULONG ulCount, IN HGDIOBJ* ahObj, OUT PGDIOBJ* apObj);
|
||||||
|
|
||||||
PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process);
|
PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process);
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define HOOK_THREAD_REFERENCED (0x1)
|
#define HOOK_THREAD_REFERENCED (0x1)
|
||||||
#define NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
|
|
||||||
#define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK)
|
#define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK)
|
||||||
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
|
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
|
||||||
#define ISITHOOKED(HookId) (((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks & HOOKID_TO_FLAG(HookId))
|
#define ISITHOOKED(HookId) (((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks & HOOKID_TO_FLAG(HookId))
|
||||||
|
|
||||||
typedef struct tagHOOKTABLE
|
|
||||||
{
|
|
||||||
LIST_ENTRY Hooks[NB_HOOKS]; /* array of hook chains */
|
|
||||||
UINT Counts[NB_HOOKS]; /* use counts for each hook chain */
|
|
||||||
} HOOKTABLE, *PHOOKTABLE;
|
|
||||||
|
|
||||||
typedef struct tagEVENTHOOK
|
typedef struct tagEVENTHOOK
|
||||||
{
|
{
|
||||||
THROBJHEAD head;
|
THROBJHEAD head;
|
||||||
|
@ -32,11 +25,22 @@ typedef struct tagEVENTTABLE
|
||||||
UINT Counts;
|
UINT Counts;
|
||||||
} EVENTTABLE, *PEVENTTABLE;
|
} EVENTTABLE, *PEVENTTABLE;
|
||||||
|
|
||||||
|
typedef struct _NOTIFYEVENT
|
||||||
|
{
|
||||||
|
DWORD event;
|
||||||
|
LONG idObject;
|
||||||
|
LONG idChild;
|
||||||
|
DWORD flags;
|
||||||
|
} NOTIFYEVENT, *PNOTIFYEVENT;
|
||||||
|
|
||||||
|
LRESULT FASTCALL co_CallHook(INT HookId, INT Code, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam);
|
LRESULT FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT FASTCALL co_EVENT_CallEvents(DWORD, HWND, UINT_PTR, LONG_PTR);
|
LRESULT FASTCALL co_EVENT_CallEvents(DWORD, HWND, UINT_PTR, LONG_PTR);
|
||||||
VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
|
VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
|
||||||
|
VOID FASTCALL EVENT_DestroyThreadEvents(PETHREAD Thread);
|
||||||
PHOOK FASTCALL IntGetHookObject(HHOOK);
|
PHOOK FASTCALL IntGetHookObject(HHOOK);
|
||||||
PHOOK FASTCALL IntGetNextHook(PHOOK Hook);
|
PHOOK FASTCALL IntGetNextHook(PHOOK Hook);
|
||||||
LRESULT FASTCALL UserCallNextHookEx( PHOOK pHook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi);
|
LRESULT FASTCALL UserCallNextHookEx( PHOOK pHook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi);
|
||||||
|
BOOL FASTCALL IntUnhookWindowsHook(int,HOOKPROC);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -45,7 +45,7 @@ IntEngLineTo(SURFOBJ *Surface,
|
||||||
MIX mix);
|
MIX mix);
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
IntEngBitBltEx(SURFOBJ *DestObj,
|
IntEngBitBlt(SURFOBJ *DestObj,
|
||||||
SURFOBJ *SourceObj,
|
SURFOBJ *SourceObj,
|
||||||
SURFOBJ *Mask,
|
SURFOBJ *Mask,
|
||||||
CLIPOBJ *ClipRegion,
|
CLIPOBJ *ClipRegion,
|
||||||
|
@ -55,14 +55,7 @@ IntEngBitBltEx(SURFOBJ *DestObj,
|
||||||
POINTL *MaskOrigin,
|
POINTL *MaskOrigin,
|
||||||
BRUSHOBJ *Brush,
|
BRUSHOBJ *Brush,
|
||||||
POINTL *BrushOrigin,
|
POINTL *BrushOrigin,
|
||||||
ROP4 Rop4,
|
ROP4 Rop4);
|
||||||
BOOL RemoveMouse);
|
|
||||||
#define IntEngBitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation, \
|
|
||||||
DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, \
|
|
||||||
Rop4) \
|
|
||||||
IntEngBitBltEx((DestObj), (SourceObj), (Mask), (ClipRegion), \
|
|
||||||
(ColorTranslation), (DestRect), (SourcePoint), \
|
|
||||||
(MaskOrigin), (Brush), (BrushOrigin), (Rop4), TRUE)
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
IntEngStretchBlt(SURFOBJ *DestObj,
|
IntEngStretchBlt(SURFOBJ *DestObj,
|
||||||
|
|
|
@ -167,9 +167,6 @@ IntGetSysColor(INT nIndex);
|
||||||
|
|
||||||
/* Other Stuff */
|
/* Other Stuff */
|
||||||
|
|
||||||
INT FASTCALL
|
|
||||||
IntGdiGetDeviceCaps(PDC dc, INT Index);
|
|
||||||
|
|
||||||
INT
|
INT
|
||||||
FASTCALL
|
FASTCALL
|
||||||
IntGdiEscape(PDC dc,
|
IntGdiEscape(PDC dc,
|
||||||
|
@ -186,14 +183,6 @@ IntEnumDisplaySettings(
|
||||||
IN OUT LPDEVMODEW pDevMode,
|
IN OUT LPDEVMODEW pDevMode,
|
||||||
IN DWORD dwFlags);
|
IN DWORD dwFlags);
|
||||||
|
|
||||||
LONG
|
|
||||||
FASTCALL
|
|
||||||
IntChangeDisplaySettings(
|
|
||||||
IN PUNICODE_STRING pDeviceName OPTIONAL,
|
|
||||||
IN LPDEVMODEW pDevMode,
|
|
||||||
IN DWORD dwflags,
|
|
||||||
IN PVOID lParam OPTIONAL);
|
|
||||||
|
|
||||||
HBITMAP
|
HBITMAP
|
||||||
FASTCALL
|
FASTCALL
|
||||||
IntCreateCompatibleBitmap(PDC Dc,
|
IntCreateCompatibleBitmap(PDC Dc,
|
||||||
|
|
86
subsystems/win32/win32k/include/ldevobj.h
Normal file
86
subsystems/win32/win32k/include/ldevobj.h
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
/* Hack, for bug in ld. Will be removed soon. */
|
||||||
|
#define __ImageBase _image_base__
|
||||||
|
#endif
|
||||||
|
extern IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
|
||||||
|
|
||||||
|
#define TAG_LDEV 'Gldv'
|
||||||
|
|
||||||
|
#define GDI_ENGINE_VERSION DDI_DRIVER_VERSION_NT5_01
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LDEV_DEVICE_DISPLAY = 1,
|
||||||
|
LDEV_DEVICE_PRINTER = 2,
|
||||||
|
LDEV_DEVICE_META = 3,
|
||||||
|
LDEV_DEVICE_MIRROR = 4,
|
||||||
|
LDEV_IMAGE = 5,
|
||||||
|
LDEV_FONT = 6,
|
||||||
|
} LDEVTYPE;
|
||||||
|
|
||||||
|
typedef struct _LDEVOBJ
|
||||||
|
{
|
||||||
|
struct _LDEVOBJ *pldevNext;
|
||||||
|
struct _LDEVOBJ *pldevPrev;
|
||||||
|
SYSTEM_GDI_DRIVER_INFORMATION *pGdiDriverInfo;
|
||||||
|
LDEVTYPE ldevtype;
|
||||||
|
ULONG cRefs;
|
||||||
|
ULONG ulDriverVersion;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
PVOID apfn[INDEX_LAST];
|
||||||
|
DRIVER_FUNCTIONS pfn;
|
||||||
|
};
|
||||||
|
|
||||||
|
} LDEVOBJ, *PLDEVOBJ;
|
||||||
|
|
||||||
|
extern PLDEVOBJ gpldevHead;
|
||||||
|
extern HSEMAPHORE ghsemDriverMgmt;
|
||||||
|
|
||||||
|
PLDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_pldevLoadImage(
|
||||||
|
PUNICODE_STRING pusPathName,
|
||||||
|
LDEVTYPE ldevtype);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_bLoadDriver(
|
||||||
|
IN PLDEVOBJ pldev);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_pvFindImageProcAddress(
|
||||||
|
IN PLDEVOBJ pldev,
|
||||||
|
IN LPSTR lpProcName);
|
||||||
|
|
||||||
|
PDEVMODEINFO
|
||||||
|
NTAPI
|
||||||
|
LDEVOBJ_pdmiGetModes(
|
||||||
|
PLDEVOBJ pldev,
|
||||||
|
HANDLE hDriver);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitLDEVImpl();
|
||||||
|
|
||||||
|
PLDEVOBJ
|
||||||
|
APIENTRY
|
||||||
|
EngLoadImageEx(
|
||||||
|
LPWSTR pwszDriverName,
|
||||||
|
ULONG ldevtype);
|
||||||
|
|
||||||
|
PLDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
EngGetLDEV(
|
||||||
|
PDEVMODEW pdm);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
APIENTRY
|
||||||
|
DriverEntry (
|
||||||
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
|
IN PUNICODE_STRING RegistryPath);
|
||||||
|
|
|
@ -29,6 +29,33 @@ VOID FASTCALL IntUserManualGuiCheck(LONG Check);
|
||||||
PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
|
PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
|
||||||
VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID);
|
VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RegOpenKey(
|
||||||
|
LPCWSTR pwszKeyName,
|
||||||
|
PHKEY phkey);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RegQueryValue(
|
||||||
|
IN HKEY hkey,
|
||||||
|
IN PCWSTR pwszValueName,
|
||||||
|
IN ULONG ulType,
|
||||||
|
OUT PVOID pvData,
|
||||||
|
IN OUT PULONG pcbValue);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RegWriteSZ(HKEY hkey, PWSTR pwszValue, PWSTR pwszData);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RegWriteDWORD(HKEY hkey, PWSTR pwszValue, DWORD dwData);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
NTAPI
|
NTAPI
|
||||||
RegReadUserSetting(
|
RegReadUserSetting(
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
|
||||||
INT INTERNAL_CALL MouseSafetyOnDrawStart(SURFOBJ *SurfObj, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2);
|
INT INTERNAL_CALL MouseSafetyOnDrawStart(PPDEVOBJ ppdev, LONG HazardX1, LONG HazardY1, LONG HazardX2, LONG HazardY2);
|
||||||
INT INTERNAL_CALL MouseSafetyOnDrawEnd(SURFOBJ *SurfObj);
|
INT INTERNAL_CALL MouseSafetyOnDrawEnd(PPDEVOBJ ppdev);
|
||||||
|
|
||||||
#ifndef XBUTTON1
|
#ifndef XBUTTON1
|
||||||
#define XBUTTON1 (0x01)
|
#define XBUTTON1 (0x01)
|
||||||
|
|
|
@ -87,9 +87,6 @@ typedef struct _USER_MESSAGE_QUEUE
|
||||||
/* Caret information for this queue */
|
/* Caret information for this queue */
|
||||||
PTHRDCARETINFO CaretInfo;
|
PTHRDCARETINFO CaretInfo;
|
||||||
|
|
||||||
/* Window hooks */
|
|
||||||
PHOOKTABLE Hooks;
|
|
||||||
|
|
||||||
/* queue state tracking */
|
/* queue state tracking */
|
||||||
WORD WakeMask;
|
WORD WakeMask;
|
||||||
WORD QueueBits;
|
WORD QueueBits;
|
||||||
|
@ -212,9 +209,6 @@ BOOL APIENTRY IntInitMessagePumpHook();
|
||||||
BOOL APIENTRY IntUninitMessagePumpHook();
|
BOOL APIENTRY IntUninitMessagePumpHook();
|
||||||
#define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
|
#define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
|
||||||
|
|
||||||
PHOOKTABLE FASTCALL MsqGetHooks(PUSER_MESSAGE_QUEUE Queue);
|
|
||||||
VOID FASTCALL MsqSetHooks(PUSER_MESSAGE_QUEUE Queue, PHOOKTABLE Hooks);
|
|
||||||
|
|
||||||
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
|
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
|
||||||
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
|
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
|
||||||
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
|
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
|
||||||
|
|
|
@ -40,7 +40,7 @@ typedef struct _PALETTE
|
||||||
PALOBJ PalObj;
|
PALOBJ PalObj;
|
||||||
XLATEOBJ *logicalToSystem;
|
XLATEOBJ *logicalToSystem;
|
||||||
HPALETTE Self;
|
HPALETTE Self;
|
||||||
ULONG Mode; // PAL_INDEXED, PAL_BITFIELDS, PAL_RGB, PAL_BGR
|
FLONG flFlags; // PAL_INDEXED, PAL_BITFIELDS, PAL_RGB, PAL_BGR
|
||||||
ULONG NumColors;
|
ULONG NumColors;
|
||||||
PALETTEENTRY *IndexedColors;
|
PALETTEENTRY *IndexedColors;
|
||||||
ULONG RedMask;
|
ULONG RedMask;
|
||||||
|
@ -52,8 +52,8 @@ typedef struct _PALETTE
|
||||||
HDEV hPDev;
|
HDEV hPDev;
|
||||||
} PALETTE, *PPALETTE;
|
} PALETTE, *PPALETTE;
|
||||||
|
|
||||||
extern PALETTE gpalRGB, gpalBGR, gpalMono;
|
extern PALETTE gpalRGB, gpalBGR, gpalMono, gpalRGB555, gpalRGB565, *gppalDefault;
|
||||||
|
extern PPALETTE appalSurfaceDefault[];
|
||||||
|
|
||||||
HPALETTE FASTCALL PALETTE_AllocPalette(ULONG Mode,
|
HPALETTE FASTCALL PALETTE_AllocPalette(ULONG Mode,
|
||||||
ULONG NumColors,
|
ULONG NumColors,
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#ifndef __WIN32K_PDEVOBJ_H
|
||||||
|
#define __WIN32K_PDEVOBJ_H
|
||||||
#include <drivers/directx/directxint.h>
|
|
||||||
|
|
||||||
/* PDEVOBJ flags */
|
/* PDEVOBJ flags */
|
||||||
#define PDEV_DISPLAY 0x00000001 /* Display device */
|
#define PDEV_DISPLAY 0x00000001 /* Display device */
|
||||||
|
@ -37,6 +36,21 @@ typedef struct _GDIPOINTER /* should stay private to ENG? No, part of PDEVOBJ ak
|
||||||
RECTL Exclude; /* required publicly for SPS_ACCEPT_EXCLUDE */
|
RECTL Exclude; /* required publicly for SPS_ACCEPT_EXCLUDE */
|
||||||
} GDIPOINTER, *PGDIPOINTER;
|
} GDIPOINTER, *PGDIPOINTER;
|
||||||
|
|
||||||
|
typedef struct _DEVMODEINFO
|
||||||
|
{
|
||||||
|
struct _DEVMODEINFO *pdmiNext;
|
||||||
|
struct _LDEVOBJ *pldev;
|
||||||
|
ULONG cbdevmode;
|
||||||
|
DEVMODEW adevmode[1];
|
||||||
|
} DEVMODEINFO, *PDEVMODEINFO;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
DWORD dwFlags;
|
||||||
|
PDEVMODEW pdm;
|
||||||
|
|
||||||
|
} DEVMODEENTRY, *PDEVMODEENTRY;
|
||||||
|
|
||||||
typedef struct _GRAPHICS_DEVICE
|
typedef struct _GRAPHICS_DEVICE
|
||||||
{
|
{
|
||||||
WCHAR szNtDeviceName[CCHDEVICENAME/2];
|
WCHAR szNtDeviceName[CCHDEVICENAME/2];
|
||||||
|
@ -48,15 +62,17 @@ typedef struct _GRAPHICS_DEVICE
|
||||||
DWORD hkClassDriverConfig;
|
DWORD hkClassDriverConfig;
|
||||||
DWORD StateFlags; /* See DISPLAY_DEVICE_* */
|
DWORD StateFlags; /* See DISPLAY_DEVICE_* */
|
||||||
ULONG cbdevmodeInfo;
|
ULONG cbdevmodeInfo;
|
||||||
PVOID devmodeInfo;
|
PDEVMODEINFO pdevmodeInfo;
|
||||||
DWORD cbdevmodeInfo1;
|
ULONG cDevModes;
|
||||||
PVOID devmodeInfo1;
|
PDEVMODEENTRY pDevModeList;
|
||||||
LPWSTR pwszDeviceNames;
|
LPWSTR pDiplayDrivers;
|
||||||
LPWSTR pwszDescription;
|
LPWSTR pwszDescription;
|
||||||
DWORD dwUnknown;
|
DWORD dwUnknown;
|
||||||
PVOID pUnknown;
|
PVOID pUnknown;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
DWORD ProtocolType;
|
DWORD ProtocolType;
|
||||||
|
ULONG iDefaultMode;
|
||||||
|
ULONG iCurrentMode;
|
||||||
} GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;
|
} GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;
|
||||||
|
|
||||||
typedef struct _PDEVOBJ
|
typedef struct _PDEVOBJ
|
||||||
|
@ -64,8 +80,8 @@ typedef struct _PDEVOBJ
|
||||||
BASEOBJECT BaseObject;
|
BASEOBJECT BaseObject;
|
||||||
|
|
||||||
struct _PDEVOBJ * ppdevNext;
|
struct _PDEVOBJ * ppdevNext;
|
||||||
INT cPdevRefs;
|
LONG cPdevRefs;
|
||||||
INT cPdevOpenRefs;
|
LONG cPdevOpenRefs;
|
||||||
struct _PDEVOBJ * ppdevParent;
|
struct _PDEVOBJ * ppdevParent;
|
||||||
FLONG flFlags; // flags
|
FLONG flFlags; // flags
|
||||||
// FLONG flAccelerated;
|
// FLONG flAccelerated;
|
||||||
|
@ -98,17 +114,17 @@ typedef struct _PDEVOBJ
|
||||||
// PFN_DrvSetPalette pfnDrvSetPalette;
|
// PFN_DrvSetPalette pfnDrvSetPalette;
|
||||||
// PFN_DrvNotify pfnDrvNotify;
|
// PFN_DrvNotify pfnDrvNotify;
|
||||||
// ULONG TagSig;
|
// ULONG TagSig;
|
||||||
// PLDEVOBJ pldev;
|
struct _LDEVOBJ * pldev;
|
||||||
DHPDEV dhpdev; /* DHPDEV for device. */
|
DHPDEV dhpdev; /* DHPDEV for device. */
|
||||||
PVOID ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
|
struct _PALETTE* ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
|
||||||
DEVINFO devinfo;
|
DEVINFO devinfo;
|
||||||
GDIINFO gdiinfo;
|
GDIINFO gdiinfo;
|
||||||
HSURF pSurface; /* SURFACE for this device., FIXME: PSURFACE */
|
PSURFACE pSurface; /* SURFACE for this device. */
|
||||||
// HANDLE hSpooler; /* Handle to spooler, if spooler dev driver. */
|
// HANDLE hSpooler; /* Handle to spooler, if spooler dev driver. */
|
||||||
// PVOID pDesktopId;
|
// PVOID pDesktopId;
|
||||||
PGRAPHICS_DEVICE pGraphicsDevice;
|
PGRAPHICS_DEVICE pGraphicsDevice;
|
||||||
POINTL ptlOrigion;
|
POINTL ptlOrigion;
|
||||||
PVOID pdmwDev; /* Ptr->DEVMODEW.dmSize + dmDriverExtra == alloc size. */
|
PDEVMODEW pdmwDev; /* Ptr->DEVMODEW.dmSize + dmDriverExtra == alloc size. */
|
||||||
// DWORD Unknown3;
|
// DWORD Unknown3;
|
||||||
FLONG DxDd_Flags; /* DxDD active status flags. */
|
FLONG DxDd_Flags; /* DxDD active status flags. */
|
||||||
// LONG devAttr;
|
// LONG devAttr;
|
||||||
|
@ -117,15 +133,12 @@ typedef struct _PDEVOBJ
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
DRIVER_FUNCTIONS DriverFunctions;
|
DRIVER_FUNCTIONS DriverFunctions;
|
||||||
|
DRIVER_FUNCTIONS pfn;
|
||||||
PVOID apfn[INDEX_LAST]; // B8C 0x0598
|
PVOID apfn[INDEX_LAST]; // B8C 0x0598
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ros specific */
|
/* ros specific */
|
||||||
ULONG DxDd_nCount;
|
ULONG DxDd_nCount;
|
||||||
ULONG DisplayNumber;
|
|
||||||
DEVMODEW DMW;
|
|
||||||
PFILE_OBJECT VideoFileObject;
|
|
||||||
BOOLEAN PreparedDriver;
|
|
||||||
GDIPOINTER Pointer;
|
GDIPOINTER Pointer;
|
||||||
/* Stuff to keep track of software cursors; win32k gdi part */
|
/* Stuff to keep track of software cursors; win32k gdi part */
|
||||||
UINT SafetyRemoveLevel; /* at what level was the cursor removed?
|
UINT SafetyRemoveLevel; /* at what level was the cursor removed?
|
||||||
|
@ -134,13 +147,47 @@ typedef struct _PDEVOBJ
|
||||||
struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl;
|
struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl;
|
||||||
} PDEVOBJ, *PPDEVOBJ;
|
} PDEVOBJ, *PPDEVOBJ;
|
||||||
|
|
||||||
/* PDEV and EDDX extra data container.*/
|
/* Globals ********************************************************************/
|
||||||
typedef struct _PDEVEDD
|
|
||||||
{
|
|
||||||
PDEVOBJ pdevobj;
|
|
||||||
EDD_DIRECTDRAW_GLOBAL EDDgpl;
|
|
||||||
} PDEVEDD, *PPDEVEDD;
|
|
||||||
|
|
||||||
PSIZEL FASTCALL PDEV_sizl(PPDEVOBJ, PSIZEL);
|
extern PPDEVOBJ gppdevPrimary;
|
||||||
|
#define pPrimarySurface gppdevPrimary
|
||||||
|
|
||||||
extern ULONG gdwDirectDrawContext;
|
|
||||||
|
/* Function prototypes ********************************************************/
|
||||||
|
|
||||||
|
PPDEVOBJ
|
||||||
|
NTAPI
|
||||||
|
EngpGetPDEV(PUNICODE_STRING pustrDevice);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vRelease(PPDEVOBJ ppdev);
|
||||||
|
|
||||||
|
PSURFACE
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_pSurface(
|
||||||
|
PPDEVOBJ ppdev);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PDEVOBJ_vGetDeviceCaps(
|
||||||
|
PPDEVOBJ ppdev,
|
||||||
|
PDEVCAPS pDevCaps);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitPDEVImpl();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitLDEVImpl();
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
InitDeviceImpl();
|
||||||
|
|
||||||
|
PSIZEL
|
||||||
|
FASTCALL
|
||||||
|
PDEVOBJ_sizl(PPDEVOBJ, PSIZEL);
|
||||||
|
|
||||||
|
#endif /* !__WIN32K_PDEVOBJ_H */
|
||||||
|
|
|
@ -14,7 +14,7 @@ typedef struct _ROSRGNDATA
|
||||||
|
|
||||||
RGNDATAHEADER rdh;
|
RGNDATAHEADER rdh;
|
||||||
RECTL *Buffer;
|
RECTL *Buffer;
|
||||||
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
|
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA, REGION, *PREGION;
|
||||||
|
|
||||||
|
|
||||||
/* Functions ******************************************************************/
|
/* Functions ******************************************************************/
|
||||||
|
|
|
@ -8,48 +8,88 @@
|
||||||
/* GDI surface object */
|
/* GDI surface object */
|
||||||
typedef struct _SURFACE
|
typedef struct _SURFACE
|
||||||
{
|
{
|
||||||
BASEOBJECT BaseObject;
|
BASEOBJECT BaseObject;
|
||||||
|
|
||||||
SURFOBJ SurfObj;
|
SURFOBJ SurfObj;
|
||||||
FLONG flHooks;
|
//XDCOBJ * pdcoAA;
|
||||||
FLONG flFlags;
|
FLONG flags;
|
||||||
struct _PALETTE *ppal;
|
struct _PALETTE *ppal;
|
||||||
|
//UINT unk_050;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
HANDLE hSecureUMPD; // if UMPD_SURFACE set
|
HANDLE hSecureUMPD; // if UMPD_SURFACE set
|
||||||
HANDLE hMirrorParent;// if MIRROR_SURFACE set
|
HANDLE hMirrorParent;// if MIRROR_SURFACE set
|
||||||
HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set
|
HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set
|
||||||
};
|
};
|
||||||
|
|
||||||
SIZEL dimension; /* For SetBitmapDimension(), do NOT use
|
SIZEL sizlDim; /* For SetBitmapDimension(), do NOT use
|
||||||
to get width/height of bitmap, use
|
to get width/height of bitmap, use
|
||||||
bitmap.bmWidth/bitmap.bmHeight for
|
bitmap.bmWidth/bitmap.bmHeight for
|
||||||
that */
|
that */
|
||||||
|
|
||||||
HDC hDC; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
|
|
||||||
ULONG cRef; // 0x064
|
|
||||||
HPALETTE hpalHint;
|
|
||||||
|
|
||||||
/* For device-independent bitmaps: */
|
HDC hdc; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
|
||||||
HANDLE hDIBSection;
|
ULONG cRef;
|
||||||
HANDLE hSecure;
|
HPALETTE hpalHint;
|
||||||
DWORD dwOffset;
|
|
||||||
|
/* For device-independent bitmaps: */
|
||||||
|
HANDLE hDIBSection;
|
||||||
|
HANDLE hSecure;
|
||||||
|
DWORD dwOffset;
|
||||||
|
//UINT unk_078;
|
||||||
|
|
||||||
/* reactos specific */
|
/* reactos specific */
|
||||||
PFAST_MUTEX BitsLock; /* You need to hold this lock before you touch
|
DWORD biClrImportant;
|
||||||
the actual bits in the bitmap */
|
|
||||||
HPALETTE hDIBPalette;
|
|
||||||
DWORD dsBitfields[3]; // hack, should probably use palette instead
|
|
||||||
DWORD biClrUsed;
|
|
||||||
DWORD biClrImportant;
|
|
||||||
} SURFACE, *PSURFACE;
|
} SURFACE, *PSURFACE;
|
||||||
|
|
||||||
#define BITMAPOBJ_IS_APIBITMAP 0x1
|
// flags field:
|
||||||
|
//#define HOOK_BITBLT 0x00000001
|
||||||
|
//#define HOOK_STRETCHBLT 0x00000002
|
||||||
|
//#define HOOK_PLGBLT 0x00000004
|
||||||
|
//#define HOOK_TEXTOUT 0x00000008
|
||||||
|
//#define HOOK_PAINT 0x00000010
|
||||||
|
//#define HOOK_STROKEPATH 0x00000020
|
||||||
|
//#define HOOK_FILLPATH 0x00000040
|
||||||
|
//#define HOOK_STROKEANDFILLPATH 0x00000080
|
||||||
|
//#define HOOK_LINETO 0x00000100
|
||||||
|
//#define SHAREACCESS_SURFACE 0x00000200
|
||||||
|
//#define HOOK_COPYBITS 0x00000400
|
||||||
|
//#define REDIRECTION_SURFACE 0x00000800 // ?
|
||||||
|
//#define HOOK_MOVEPANNING 0x00000800
|
||||||
|
//#define HOOK_SYNCHRONIZE 0x00001000
|
||||||
|
//#define HOOK_STRETCHBLTROP 0x00002000
|
||||||
|
//#define HOOK_SYNCHRONIZEACCESS 0x00004000
|
||||||
|
//#define USE_DEVLOCK_SURFACE 0x00004000
|
||||||
|
//#define HOOK_TRANSPARENTBLT 0x00008000
|
||||||
|
//#define HOOK_ALPHABLEND 0x00010000
|
||||||
|
//#define HOOK_GRADIENTFILL 0x00020000
|
||||||
|
//#if (NTDDI_VERSION < 0x06000000)
|
||||||
|
// #define HOOK_FLAGS 0x0003B5FF
|
||||||
|
//#else
|
||||||
|
// #define HOOK_FLAGS 0x0003B5EF
|
||||||
|
//#endif
|
||||||
|
#define UMPD_SURFACE 0x00040000
|
||||||
|
#define MIRROR_SURFACE 0x00080000
|
||||||
|
#define DIRECTDRAW_SURFACE 0x00100000
|
||||||
|
#define DRIVER_CREATED_SURFACE 0x00200000
|
||||||
|
#define ENG_CREATE_DEVICE_SURFACE 0x00400000
|
||||||
|
#define DDB_SURFACE 0x00800000
|
||||||
|
#define LAZY_DELETE_SURFACE 0x01000000
|
||||||
|
#define BANDING_SURFACE 0x02000000
|
||||||
|
#define API_BITMAP 0x04000000
|
||||||
|
#define PALETTE_SELECT_SET 0x08000000
|
||||||
|
#define UNREADABLE_SURFACE 0x10000000
|
||||||
|
#define DYNAMIC_MODE_PALETTE 0x20000000
|
||||||
|
#define ABORT_SURFACE 0x40000000
|
||||||
|
#define PDEV_SURFACE 0x80000000
|
||||||
|
|
||||||
|
|
||||||
|
#define BMF_DONT_FREE 0x100
|
||||||
|
#define BMF_RLE_HACK 0x200
|
||||||
|
|
||||||
|
|
||||||
/* Internal interface */
|
/* Internal interface */
|
||||||
|
|
||||||
#define SURFACE_AllocSurface() ((PSURFACE) GDIOBJ_AllocObj(GDIObjType_SURF_TYPE))
|
|
||||||
#define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP))
|
#define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP))
|
||||||
#define SURFACE_FreeSurface(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_SURF_TYPE)
|
#define SURFACE_FreeSurface(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_SURF_TYPE)
|
||||||
#define SURFACE_FreeSurfaceByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
#define SURFACE_FreeSurfaceByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
|
||||||
|
@ -64,15 +104,31 @@ typedef struct _SURFACE
|
||||||
#define SURFACE_ShareUnlockSurface(pBMObj) \
|
#define SURFACE_ShareUnlockSurface(pBMObj) \
|
||||||
GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
|
GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
|
||||||
|
|
||||||
#define SURFACE_LockBitmapBits(pBMObj) ExEnterCriticalRegionAndAcquireFastMutexUnsafe((pBMObj)->BitsLock)
|
|
||||||
#define SURFACE_UnlockBitmapBits(pBMObj) ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((pBMObj)->BitsLock)
|
|
||||||
|
|
||||||
BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody);
|
BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody);
|
||||||
BOOL INTERNAL_CALL SURFACE_InitBitsLock(SURFACE *pBMObj);
|
|
||||||
void INTERNAL_CALL SURFACE_CleanupBitsLock(SURFACE *pBMObj);
|
PSURFACE
|
||||||
|
NTAPI
|
||||||
|
SURFACE_AllocSurface(
|
||||||
|
IN ULONG iType,
|
||||||
|
IN ULONG cx,
|
||||||
|
IN ULONG cy,
|
||||||
|
IN ULONG iFormat);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
SURFACE_bSetBitmapBits(
|
||||||
|
IN PSURFACE psurf,
|
||||||
|
IN USHORT fjBitmap,
|
||||||
|
IN ULONG ulWidth,
|
||||||
|
IN PVOID pvBits OPTIONAL);
|
||||||
|
|
||||||
#define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
|
#define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
|
||||||
#define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
|
#define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
|
||||||
|
|
||||||
INT FASTCALL BitsPerFormat (ULONG Format);
|
|
||||||
ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
|
ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
|
||||||
|
extern UCHAR gajBitsPerFormat[];
|
||||||
|
#define BitsPerFormat(Format) gajBitsPerFormat[Format]
|
||||||
|
|
||||||
|
#define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3)
|
||||||
|
#define WIDTH_BYTES_ALIGN16(cx, bpp) ((((cx) * (bpp) + 15) & ~15) >> 3)
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue