Should use LONG_PTR for plugin code due to Win64. b=472025 r=josh sr=jst

This commit is contained in:
Makoto Kato 2009-01-13 13:15:39 -05:00
Родитель 36481b63a9
Коммит 2cce8fad67
16 изменённых файлов: 45 добавлений и 40 удалений

Просмотреть файл

@ -331,8 +331,13 @@ struct nsPluginEvent {
#elif defined(XP_WIN)
uint16 event;
#if defined(_WIN64)
uint64 wParam;
uint64 lParam;
#else
uint32 wParam;
uint32 lParam;
#endif /* _WIN64 */
#elif defined(XP_UNIX) && defined(MOZ_X11)
XEvent event;

Просмотреть файл

@ -490,7 +490,7 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPl
// We need WndProc before plug-ins do subclass in nsPluginNativeWindow::CallSetWindow.
if (aPluginInstance) {
WNDPROC currentWndProc = (WNDPROC)::GetWindowLong((HWND)window, GWL_WNDPROC);
WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr((HWND)window, GWLP_WNDPROC);
if (currentWndProc != PluginWndProc)
mPrevWinProc = currentWndProc;
}
@ -518,11 +518,11 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
return NS_ERROR_FAILURE;
// check if we need to re-subclass
WNDPROC currentWndProc = (WNDPROC)::GetWindowLong(hWnd, GWL_WNDPROC);
WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
if (PluginWndProc == currentWndProc)
return NS_OK;
mPluginWinProc = SubclassWindow(hWnd, (LONG)PluginWndProc);
mPluginWinProc = SubclassWindow(hWnd, (LONG_PTR)PluginWndProc);
if (!mPluginWinProc)
return NS_ERROR_FAILURE;
@ -548,9 +548,9 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
// restore the original win proc
// but only do this if this were us last time
if (mPluginWinProc) {
WNDPROC currentWndProc = (WNDPROC)::GetWindowLong(hWnd, GWL_WNDPROC);
WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
if (currentWndProc == PluginWndProc)
SubclassWindow(hWnd, (LONG)mPluginWinProc);
SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
}
return NS_OK;

Просмотреть файл

@ -46,7 +46,7 @@
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
switch (id)
{
case IDC_GET_PLUGIN:
@ -75,7 +75,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
if(pPlugin == NULL)
return TRUE;
SetWindowLong(hWnd, DWL_USER, (LONG)pPlugin);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
pPlugin->m_hWndDialog = hWnd;

Просмотреть файл

@ -727,14 +727,14 @@ void CPlugin::onPaint(HWND hWnd)
//**************************
static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CPlugin *pPlugin = (CPlugin *)GetWindowLong(hWnd, GWL_USERDATA);
CPlugin *pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch(message)
{
case WM_CREATE:
pPlugin = (CPlugin *)(((CREATESTRUCT FAR*)lParam)->lpCreateParams);
assert(pPlugin != NULL);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)pPlugin);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pPlugin);
pPlugin->onCreate(hWnd);
return 0L;
case WM_LBUTTONUP:

Просмотреть файл

@ -106,7 +106,7 @@ NPBool nsPluginInstance::init(NPWindow* aWindow)
// associate window with our nsPluginInstance object so we can access
// it in the window procedure
SetWindowLong(mhWnd, GWL_USERDATA, (LONG)this);
SetWindowLongPtr(mhWnd, GWLP_USERDATA, (LONG_PTR)this);
mInitialized = TRUE;
return TRUE;
@ -143,7 +143,7 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
FrameRect(hdc, &rc, GetStockBrush(BLACK_BRUSH));
// get our plugin instance object and ask it for the version string
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (plugin) {
const char * string = plugin->getVersion();
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

Просмотреть файл

@ -635,7 +635,7 @@ NPBool CPlugin::init(NPWindow* pNPWindow)
// associate window with our CPlugin object so we can access
// it in the window procedure
SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this);
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
#endif
m_Window = pNPWindow;
@ -746,7 +746,7 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
RECT rc;
GetClientRect(hWnd, &rc);
FrameRect(hdc, &rc, GetStockBrush(BLACK_BRUSH));
CPlugin * p = (CPlugin *)GetWindowLong(hWnd, GWL_USERDATA);
CPlugin * p = (CPlugin *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if(p) {
if (p->m_String[0] == 0) {
strcpy("foo", p->m_String);

Просмотреть файл

@ -770,7 +770,7 @@ nsresult EventsPluginInstance::PlatformDestroy(void) {
nsresult EventsPluginInstance::PlatformCreateWindow(nsPluginWindow* window) {
// Remember parent wndproc.
fPlatform.fParentWindowProc = (WNDPROC)::GetWindowLong(wMain, GWL_WNDPROC);
fPlatform.fParentWindowProc = (WNDPROC)::GetWindowLongPtr(wMain, GWLP_WNDPROC);
NS_ABORT_IF_FALSE(fPlatform.fParentWindowProc!=NULL, "Couldn't get the parent WNDPROC");
// Create the child window that fills our nsWindow
@ -791,9 +791,9 @@ nsresult EventsPluginInstance::PlatformCreateWindow(nsPluginWindow* window) {
// Stash away our "this" pointer so our WNDPROC can talk to us.
::SetProp(wChild, gInstanceLookupString, (HANDLE)this);
fPlatform.fOldChildWindowProc =
(WNDPROC)::SetWindowLong( wChild,
GWL_WNDPROC,
(LONG)EventsPluginInstance::WndProcChild);
(WNDPROC)::SetWindowLongPtr( wChild,
GWLP_WNDPROC,
(LONG_PTR)EventsPluginInstance::WndProcChild);
return NS_OK;
}
@ -806,7 +806,7 @@ void EventsPluginInstance::PlatformResetWindow() {
printf("EventsPluginInstance::PlatformResetWindow\n");
#endif
fPlatform.fParentWindowProc = NULL;
::SetWindowLong(wChild, GWL_WNDPROC, (LONG)fPlatform.fOldChildWindowProc);
::SetWindowLongPtr(wChild, GWLP_WNDPROC, (LONG_PTR)fPlatform.fOldChildWindowProc);
fPlatform.fOldChildWindowProc = NULL;
wChild = NULL;
wMain = NULL;

Просмотреть файл

@ -45,7 +45,7 @@
static void onApply(HWND hWnd)
{
Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!logger)
return;
@ -72,7 +72,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
if(lParam)
{
logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
SetWindowLong(hWnd, DWL_USER, (long)logger);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
}
if(logger)

Просмотреть файл

@ -66,7 +66,7 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static void onApply(HWND hWnd)
{
Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!logger)
return;
@ -101,7 +101,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
if(lParam)
{
logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
SetWindowLong(hWnd, DWL_USER, (long)logger);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
}
BOOL * mutedcalls = logger->getMutedCalls();

Просмотреть файл

@ -45,7 +45,7 @@
static void onApply(HWND hWnd)
{
Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!logger)
return;
@ -72,7 +72,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
if(lParam)
{
logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
SetWindowLong(hWnd, DWL_USER, (long)logger);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
}
if(logger)

Просмотреть файл

@ -46,7 +46,7 @@
static void onChooseDir(HWND hWnd)
{
Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!logger)
return;
@ -97,7 +97,7 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static void onApply(HWND hWnd)
{
Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!logger)
return;
@ -130,7 +130,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
if(lParam)
{
logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
SetWindowLong(hWnd, DWL_USER, (long)logger);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
}
if(logger)

Просмотреть файл

@ -145,7 +145,7 @@ static void onOptions(HWND hWnd, Logger * logger)
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{
LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER);
LoggerWin * logger = (LoggerWin *)GetWindowLongPtr(hWnd, DWLP_USER);
switch (id)
{
case IDC_CHECK_MUTE:
@ -167,7 +167,7 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{
LoggerWin * logger = (LoggerWin *)lParam;
SetWindowLong(hWnd, DWL_USER, (long)logger);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
SetWindowText(hWnd, szAppName);
HFONT hFont = GetStockFont(ANSI_FIXED_FONT);
SetWindowFont(GetDlgItem(hWnd, IDC_MAIN_OUTPUT), hFont, FALSE);
@ -185,7 +185,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
static void onDestroy(HWND hWnd)
{
LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER);
LoggerWin * logger = (LoggerWin *)GetWindowLongPtr(hWnd, DWLP_USER);
if(logger)
logger->onDestroyWindow();
}

Просмотреть файл

@ -52,7 +52,7 @@ static CScripter * pScripter = NULL;
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!pPlugin)
return;
@ -197,7 +197,7 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{
CPlugin * pPlugin = (CPlugin *)lParam;
SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
int iTopMargin = 188;
SetWindowPos(hWnd, NULL, 0,iTopMargin, 0,0, SWP_NOZORDER | SWP_NOSIZE);

Просмотреть файл

@ -52,7 +52,7 @@ extern CLogger * pLogger;
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
if (!pPlugin)
return;
@ -179,7 +179,7 @@ static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{
CPlugin * pPlugin = (CPlugin *)lParam;
SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
// look at the last used API call if needed
int iSel = 0;
@ -198,7 +198,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
static void onDestroy(HWND hWnd)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
if(pPlugin && pPlugin->m_Pref_bRememberLastCall) {
// save last API call if needed
char szFileName[_MAX_PATH];

Просмотреть файл

@ -48,7 +48,7 @@ extern CLogger * pLogger;
static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
if(!pPlugin)
return;
@ -128,7 +128,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
{
CPlugin * pPlugin = (CPlugin *)lParam;
SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
SetWindowPos(hWnd, NULL, 0,0, 0,0, SWP_NOZORDER | SWP_NOSIZE);
@ -163,7 +163,7 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
static void onDestroy(HWND hWnd)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
pPlugin->onDestroy();
}

Просмотреть файл

@ -169,7 +169,7 @@ static void replaceEditWithCombo(HWND hWnd, BOOL b1, BOOL b2, BOOL b3, BOOL b6)
void updateUI(HWND hWnd)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
assert(pPlugin != NULL);
DWORD dwNPInstance = (DWORD)pPlugin->getNPInstance();
@ -437,7 +437,7 @@ NPByteRange g_npByteRangeList[] = {
void onGo(HWND hWnd)
{
CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
assert(pPlugin != NULL);
char szString[80];