fixes bug 258217 "Windows DDE code should extract application name from nsXREAppData" r=bsmedberg

This commit is contained in:
darin%meer.net 2004-09-07 22:24:45 +00:00
parent 62eccfe2cf
commit 6accf3753f
10 changed files with 11 additions and 82 deletions

View File

@ -48,10 +48,8 @@ IDI_APPLICATION ICON FIREFOX_ICO
STRINGTABLE DISCARDABLE
BEGIN
#ifdef DEBUG
ID_DDE_APPLICATION_NAME, "Firefox Debug"
IDS_STARTMENU_APPNAME, "Firefox Debug"
#else
ID_DDE_APPLICATION_NAME, "Firefox"
IDS_STARTMENU_APPNAME, "Firefox"
#endif
END

View File

@ -29,10 +29,6 @@
// Splash screen bitmap ID.
#define IDB_SPLASH 101
// DDE application name
#define ID_DDE_APPLICATION_NAME 102
ICON 1 FIREFOX_ICO
DLGTEMPLATE IDD_SPLASH DISCARDABLE
@ -44,15 +40,6 @@ END
//BITMAP IDB_SPLASH "splash.bmp"
STRINGTABLE DISCARDABLE
BEGIN
#ifdef DEBUG
ID_DDE_APPLICATION_NAME, "Firefox Debug"
#else
ID_DDE_APPLICATION_NAME, "Firefox"
#endif
END
#ifdef MOZ_STATIC_BUILD
#include "wdgtos2rc.h"

View File

@ -44,15 +44,11 @@
IDI_APPICON ICON "sunbird.ico"
IDI_APPLICATION ICON "sunbird.ico"
#define ID_DDE_APPLICATION_NAME 102
STRINGTABLE DISCARDABLE
BEGIN
#ifdef DEBUG
ID_DDE_APPLICATION_NAME, "Sunbird Debug"
IDS_STARTMENU_APPNAME, "Sunbird Debug"
#else
ID_DDE_APPLICATION_NAME, "Sunbird"
IDS_STARTMENU_APPNAME, "Sunbird"
#endif
END

View File

@ -29,10 +29,6 @@
// Splash screen bitmap ID.
#define IDB_SPLASH 101
// DDE application name
#define ID_DDE_APPLICATION_NAME 102
ICON 1 SUNBIRD_ICO
DLGTEMPLATE IDD_SPLASH DISCARDABLE
@ -44,15 +40,6 @@ END
//BITMAP IDB_SPLASH "splash.bmp"
STRINGTABLE DISCARDABLE
BEGIN
#ifdef DEBUG
ID_DDE_APPLICATION_NAME, "Sunbird Debug"
#else
ID_DDE_APPLICATION_NAME, "Sunbird"
#endif
END
#ifdef MOZ_STATIC_BUILD
#include "wdgtos2rc.h"

View File

@ -91,9 +91,6 @@
// Splash screen bitmap ID.
#define IDB_SPLASH 101
// DDE application name
#define ID_DDE_APPLICATION_NAME 102
// Program icon.
IDI_APPLICATION ICON
"mozilla.ico"
@ -120,7 +117,6 @@ IDD_SPLASH DIALOGEX
STRINGTABLE DISCARDABLE
BEGIN
ID_DDE_APPLICATION_NAME, "Composer"
IDS_STARTMENU_APPNAME, "Composer"
END

View File

@ -46,9 +46,6 @@
// Splash screen bitmap ID.
#define IDB_SPLASH 101
// DDE application name
#define ID_DDE_APPLICATION_NAME 102
// Program icon.
IDI_APPLICATION ICON
"mozilla.ico"
@ -75,6 +72,5 @@ IDD_SPLASH DIALOGEX
STRINGTABLE DISCARDABLE
BEGIN
ID_DDE_APPLICATION_NAME, "Composer"
IDS_STARTMENU_APPNAME, "Composer"
END

View File

@ -43,15 +43,11 @@
// Program icon.
IDI_APPLICATION ICON THUNDERBIRD_ICO
#define ID_DDE_APPLICATION_NAME 102
STRINGTABLE DISCARDABLE
BEGIN
#ifdef DEBUG
ID_DDE_APPLICATION_NAME, "Thunderbird Debug"
IDS_STARTMENU_APPNAME, "Thunderbird Debug"
#else
ID_DDE_APPLICATION_NAME, "Thunderbird"
IDS_STARTMENU_APPNAME, "Thunderbird"
#endif
END

View File

@ -29,10 +29,6 @@
// Splash screen bitmap ID.
#define IDB_SPLASH 101
// DDE application name
#define ID_DDE_APPLICATION_NAME 102
ICON 1 "mozos2.ico"
DLGTEMPLATE IDD_SPLASH DISCARDABLE
@ -44,11 +40,6 @@ END
//BITMAP IDB_SPLASH "splash.bmp"
STRINGTABLE DISCARDABLE
BEGIN
ID_DDE_APPLICATION_NAME, "Thunderbird"
END
#ifdef MOZ_STATIC_BUILD
// XXX This code is copied from resource.h and widget.rc. It's a work-around

View File

@ -45,6 +45,8 @@
#include "nsNativeAppSupportBase.h"
#include "nsNativeAppSupportOS2.h"
#include "nsAppRunner.h"
#include "nsXULAppAPI.h"
#include "nsString.h"
#include "nsICmdLineService.h"
#include "nsCOMPtr.h"
@ -342,7 +344,6 @@ private:
static HSZ mApplication, mTopics[ topicCount ];
static DWORD mInstance;
static char *mAppName;
static PRBool mCanHandleRequests;
static char mMutexName[];
static PRBool mUseDDE;
@ -581,7 +582,7 @@ struct MessageWindow {
if ( !mClassName ) {
sprintf( classNameBuffer,
"%s%s",
nsNativeAppSupportOS2::mAppName,
gAppData->appName,
"MessageWindow" );
mClassName = classNameBuffer;
}
@ -716,8 +717,6 @@ private:
USHORT mMsgWindowAtom;
}; // struct MessageWindow
static char nameBuffer[128] = { 0 };
char *nsNativeAppSupportOS2::mAppName = nameBuffer;
PRBool nsNativeAppSupportOS2::mUseDDE = PR_FALSE;
/* Start: Tries to find the "message window" to determine if it
@ -754,17 +753,9 @@ nsNativeAppSupportOS2::Start( PRBool *aResult ) {
}
// Grab mutex first.
int retval;
UINT id = ID_DDE_APPLICATION_NAME;
retval = WinLoadString( NULLHANDLE, NULLHANDLE, id, sizeof(nameBuffer), nameBuffer );
if ( retval == 0 ) {
// No app name; just keep running.
*aResult = PR_TRUE;
return NS_OK;
}
// Build mutex name from app name.
PR_snprintf( mMutexName, sizeof mMutexName, "%s%s", nameBuffer, MOZ_STARTUP_MUTEX_NAME );
PR_snprintf( mMutexName, sizeof mMutexName, "%s%s", gAppData->appName, MOZ_STARTUP_MUTEX_NAME );
Mutex startupLock = Mutex( mMutexName );
NS_ENSURE_TRUE( startupLock.Lock( MOZ_DDE_START_TIMEOUT ), NS_ERROR_FAILURE );
@ -875,7 +866,7 @@ nsNativeAppSupportOS2::StartDDE() {
NS_ERROR_FAILURE );
// Allocate DDE strings.
NS_ENSURE_TRUE( ( mApplication = WinDdeCreateStringHandle( mAppName, CP_WINANSI ) ) && InitTopicStrings(),
NS_ENSURE_TRUE( ( mApplication = WinDdeCreateStringHandle( gAppData->appName, CP_WINANSI ) ) && InitTopicStrings(),
NS_ERROR_FAILURE );
// Next step is to register a DDE service.

View File

@ -38,6 +38,8 @@
#include "nsNativeAppSupportBase.h"
#include "nsNativeAppSupportWin.h"
#include "nsAppRunner.h"
#include "nsXULAppAPI.h"
#include "nsString.h"
#include "nsICmdLineService.h"
#include "nsCOMPtr.h"
@ -318,7 +320,6 @@ private:
static HSZ mApplication, mTopics[ topicCount ];
static DWORD mInstance;
static char *mAppName;
static PRBool mCanHandleRequests;
static PRBool mSupportingDDEExec;
static char mMutexName[];
@ -447,7 +448,7 @@ struct MessageWindow {
::_snprintf( classNameBuffer,
sizeof classNameBuffer,
"%s%s",
nsNativeAppSupportWin::mAppName,
gAppData->appName,
"MessageWindow" );
mClassName = classNameBuffer;
}
@ -566,9 +567,6 @@ private:
HWND mHandle;
}; // struct MessageWindow
static char nameBuffer[128] = { 0 };
char *nsNativeAppSupportWin::mAppName = nameBuffer;
/* Start: Tries to find the "message window" to determine if it
* exists. If so, then Mozilla is already running. In that
* case, we use the handle to the "message" window and send
@ -585,6 +583,7 @@ NS_IMETHODIMP
nsNativeAppSupportWin::Start( PRBool *aResult ) {
NS_ENSURE_ARG( aResult );
NS_ENSURE_TRUE( mInstance == 0, NS_ERROR_NOT_INITIALIZED );
NS_ENSURE_STATE( gAppData );
if (getenv("MOZ_NO_REMOTE"))
{
@ -596,17 +595,9 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
*aResult = PR_FALSE;
// Grab mutex first.
int retval;
UINT id = ID_DDE_APPLICATION_NAME;
retval = LoadString( (HINSTANCE) NULL, id, (LPTSTR) nameBuffer, sizeof(nameBuffer) );
if ( retval == 0 ) {
// No app name; just keep running.
*aResult = PR_TRUE;
return NS_OK;
}
// Build mutex name from app name.
::_snprintf( mMutexName, sizeof mMutexName, "%s%s", nameBuffer, MOZ_STARTUP_MUTEX_NAME );
::_snprintf( mMutexName, sizeof mMutexName, "%s%s", gAppData->appName, MOZ_STARTUP_MUTEX_NAME );
Mutex startupLock = Mutex( mMutexName );
NS_ENSURE_TRUE( startupLock.Lock( MOZ_DDE_START_TIMEOUT ), NS_ERROR_FAILURE );
@ -733,7 +724,7 @@ nsNativeAppSupportWin::StartDDE() {
NS_ERROR_FAILURE );
// Allocate DDE strings.
NS_ENSURE_TRUE( ( mApplication = DdeCreateStringHandle( mInstance, mAppName, CP_WINANSI ) ) && InitTopicStrings(),
NS_ENSURE_TRUE( ( mApplication = DdeCreateStringHandle( mInstance, gAppData->appName, CP_WINANSI ) ) && InitTopicStrings(),
NS_ERROR_FAILURE );
// Next step is to register a DDE service.