Commit 87af7526 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Register window class on mciavi driver loading, and unregister it on

driver unloading.
parent d81e04a8
...@@ -140,6 +140,8 @@ static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -140,6 +140,8 @@ static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
/* session instance */ /* session instance */
if (!modp) return 0xFFFFFFFF; if (!modp) return 0xFFFFFFFF;
if (!MCIAVI_RegisterClass()) return 0;
wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI)); wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
if (!wma) if (!wma)
return 0; return 0;
...@@ -169,6 +171,8 @@ static DWORD MCIAVI_drvClose(DWORD dwDevID) ...@@ -169,6 +171,8 @@ static DWORD MCIAVI_drvClose(DWORD dwDevID)
wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID); wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
if (wma) { if (wma) {
MCIAVI_UnregisterClass();
EnterCriticalSection(&wma->cs); EnterCriticalSection(&wma->cs);
mciSetDriverData(dwDevID, 0); mciSetDriverData(dwDevID, 0);
......
...@@ -103,7 +103,9 @@ LRESULT MCIAVI_PaintFrame(WINE_MCIAVI* wma, HDC hDC); ...@@ -103,7 +103,9 @@ LRESULT MCIAVI_PaintFrame(WINE_MCIAVI* wma, HDC hDC);
WINE_MCIAVI* MCIAVI_mciGetOpenDev(UINT wDevID); WINE_MCIAVI* MCIAVI_mciGetOpenDev(UINT wDevID);
DWORD MCIAVI_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS); DWORD MCIAVI_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
/* window.c */ /* wnd.c */
BOOL MCIAVI_RegisterClass(void);
BOOL MCIAVI_UnregisterClass(void);
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms); BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms);
DWORD MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms); DWORD MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms);
DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms); DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms);
......
...@@ -86,28 +86,36 @@ static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA ...@@ -86,28 +86,36 @@ static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
return 0; return 0;
} }
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms) BOOL MCIAVI_UnregisterClass(void)
{ {
WNDCLASSA wndClass; return UnregisterClassA("MCIAVI", MCIAVI_hInstance);
HWND hParent = 0; }
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
int p = CW_USEDEFAULT;
RECT rc;
/* what should be done ? */ BOOL MCIAVI_RegisterClass(void)
if (wma->hWnd) return TRUE; {
WNDCLASSA wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSA)); ZeroMemory(&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_DBLCLKS; wndClass.style = CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)MCIAVI_WindowProc; wndClass.lpfnWndProc = (WNDPROC)MCIAVI_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(MCIDEVICEID); wndClass.cbWndExtra = sizeof(MCIDEVICEID);
wndClass.hInstance = MCIAVI_hInstance; wndClass.hInstance = MCIAVI_hInstance;
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = "MCIAVI"; wndClass.lpszClassName = "MCIAVI";
if (!RegisterClassA(&wndClass)) return FALSE; return RegisterClassA(&wndClass);
}
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms)
{
HWND hParent = 0;
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
int p = CW_USEDEFAULT;
RECT rc;
/* what should be done ? */
if (wma->hWnd) return TRUE;
if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpOpenParms->hWndParent; if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpOpenParms->hWndParent;
if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle; if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment