diff --git a/mozilla/modules/plugin/npspy/include/actionnames.h b/mozilla/modules/plugin/npspy/include/actionnames.h new file mode 100644 index 00000000000..374cd9d8e28 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/actionnames.h @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __ACTIONNAMES_H__ +#define __ACTIONNAMES_H__ + +// the order is important +char * ActionName[] = +{ + "INVALID_CALL", + "NPN_Version", + "NPN_GetURLNotify", + "NPN_GetURL", + "NPN_PostURLNotify", + "NPN_PostURL", + "NPN_RequestRead", + "NPN_NewStream", + "NPN_Write", + "NPN_DestroyStream", + "NPN_Status", + "NPN_UserAgent", + "NPN_MemAlloc", + "NPN_MemFree", + "NPN_MemFlush", + "NPN_ReloadPlugins", + "NPN_GetJavaEnv", + "NPN_GetJavaPeer", + "NPN_GetValue", + "NPN_SetValue", + "NPN_InvalidateRect", + "NPN_InvalidateRegion", + "NPN_ForceRedraw", + "NPP_New", + "NPP_Destroy", + "NPP_SetWindow", + "NPP_NewStream", + "NPP_DestroyStream", + "NPP_StreamAsFile", + "NPP_WriteReady", + "NPP_Write", + "NPP_Print", + "NPP_HandleEvent", + "NPP_URLNotify", + "NPP_GetJavaClass", + "NPP_GetValue", + "NPP_SetValue" +}; + +#endif diff --git a/mozilla/modules/plugin/npspy/include/dirpick.h b/mozilla/modules/plugin/npspy/include/dirpick.h new file mode 100644 index 00000000000..cd01fc58be6 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/dirpick.h @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __DIRPICK_H__ +#define __DIRPICK_H__ + +// pops up "Choose Directory" dialog box allowing to browse the directry +// structure. Returns TRUE on OK and FALSE on Cancel. Directory chosen +// returned in lpszString. Use lpszString to initialize the dialog box. If +// specified directory does not exist it will start with the current directory +BOOL PickupDirectory(HWND hWndOwner, LPSTR lpszString); + +#endif // __DIRPICK_H__ \ No newline at end of file diff --git a/mozilla/modules/plugin/npspy/include/epmanager.h b/mozilla/modules/plugin/npspy/include/epmanager.h new file mode 100644 index 00000000000..11aa38afbff --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/epmanager.h @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __EPMANAGER_H__ +#define __EPMANAGER_H__ + +#include "npapi.h" +#include "npupp.h" + +typedef NPError (__stdcall * NP_GETENTRYPOINTS) (NPPluginFuncs* pFuncs); +typedef NPError (__stdcall * NP_INITIALIZE) (NPNetscapeFuncs* pFuncs); +typedef NPError (__stdcall * NP_SHUTDOWN) (void); + +struct InstanceList +{ + InstanceList * next; + NPP instance; + + InstanceList(NPP _instance); + ~InstanceList(); +}; + +struct PluginEntryPointList +{ + PluginEntryPointList * next; + char mimetype[80]; + InstanceList * instances; + NPPluginFuncs realNPPFuncs; + NP_SHUTDOWN realShutdown; + XP_HLIB hLib; + + PluginEntryPointList(); + ~PluginEntryPointList(); +}; + +class NPPEntryPointManager +{ +private: + PluginEntryPointList * mEntryPoints; + +public: + void createEntryPointsForPlugin(char * mimetype, NPPluginFuncs * funcs, NP_SHUTDOWN shutdownproc, XP_HLIB hLib); + void removeEntryPointsForPlugin(NPP instance, XP_HLIB * lib); + NPPluginFuncs * findEntryPointsForPlugin(char * mimetype); + +private: + NPPluginFuncs * findEntryPointsForInstance(NPP instance); + +public: + NPPEntryPointManager(); + ~NPPEntryPointManager(); + + void callNP_Shutdown(NPP instance); + void callNP_ShutdownAll(); + + NPError callNPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); + NPError callNPP_Destroy(NPP instance, NPSavedData** save, BOOL * last); + NPError callNPP_SetWindow(NPP instance, NPWindow* window); + NPError callNPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); + NPError callNPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); + int32 callNPP_WriteReady(NPP instance, NPStream* stream); + int32 callNPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); + void callNPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); + void callNPP_Print(NPP instance, NPPrint* platformPrint); + void callNPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); + jref callNPP_GetJavaClass(void); + NPError callNPP_GetValue(NPP instance, NPPVariable variable, void *value); + NPError callNPP_SetValue(NPP instance, NPNVariable variable, void *value); + int16 callNPP_HandleEvent(NPP instance, void* event); +}; + +#endif diff --git a/mozilla/modules/plugin/npspy/include/format.h b/mozilla/modules/plugin/npspy/include/format.h new file mode 100644 index 00000000000..b2659e4ad23 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/format.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __FORMAT_H__ +#define __FORMAT_H__ + +#include "npapi.h" + +typedef enum +{ + action_invalid = 0, + action_npn_version, + action_npn_get_url_notify, + action_npn_get_url, + action_npn_post_url_notify, + action_npn_post_url, + action_npn_request_read, + action_npn_new_stream, + action_npn_write, + action_npn_destroy_stream, + action_npn_status, + action_npn_user_agent, + action_npn_mem_alloc, + action_npn_mem_free, + action_npn_mem_flush, + action_npn_reload_plugins, + action_npn_get_java_env, + action_npn_get_java_peer, + action_npn_get_value, + action_npn_set_value, + action_npn_invalidate_rect, + action_npn_invalidate_region, + action_npn_force_redraw, + + action_npp_new, + action_npp_destroy, + action_npp_set_window, + action_npp_new_stream, + action_npp_destroy_stream, + action_npp_stream_as_file, + action_npp_write_ready, + action_npp_write, + action_npp_print, + action_npp_handle_event, + action_npp_url_notify, + action_npp_get_java_class, + action_npp_get_value, + action_npp_set_value +} NPAPI_Action; + +struct LogArgumentStruct +{ + DWORD dwArg; + int iLength; + void * pData; + + LogArgumentStruct() + { + iLength = 0; + pData = NULL; + } + + ~LogArgumentStruct() + { + if(pData != NULL) + delete [] pData; + iLength = 0; + } +}; + +struct LogItemStruct +{ + NPAPI_Action action; + LogArgumentStruct arg1; + LogArgumentStruct arg2; + LogArgumentStruct arg3; + LogArgumentStruct arg4; + LogArgumentStruct arg5; + LogArgumentStruct arg6; + LogArgumentStruct arg7; + + LogItemStruct(){} + ~LogItemStruct(){} +}; + +char * FormatNPAPIError(int iError); +char * FormatNPAPIReason(int iReason); +char * FormatNPPVariable(NPPVariable var); +char * FormatNPNVariable(NPNVariable var); +BOOL FormatPCHARArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +BOOL FormatBOOLArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +BOOL FormatPBOOLArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +LogItemStruct * makeLogItemStruct(NPAPI_Action action, + DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4, + DWORD dw5, DWORD dw6, DWORD dw7, BOOL bShort = FALSE); +void freeLogItemStruct(LogItemStruct * lis); +int formatLogItem(LogItemStruct * plis, char * szOutput, BOOL bDOSStyle = FALSE); + +#endif // __LOGHLP_H__ diff --git a/mozilla/modules/plugin/npspy/include/logfile.h b/mozilla/modules/plugin/npspy/include/logfile.h new file mode 100644 index 00000000000..46e438e78a3 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/logfile.h @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __LOGFILE_H__ +#define __LOGFILE_H__ + +class CLogFile +{ +private: + char szFileName[256]; + XP_HFILE hFile; + +public: + CLogFile(); + ~CLogFile(); + + BOOL create(char * filename, BOOL delete_existing = FALSE); + void close(); + DWORD write(char * buf); + void flush(); +}; + +#endif // __LOGFILE_H__ diff --git a/mozilla/modules/plugin/npspy/include/logger.h b/mozilla/modules/plugin/npspy/include/logger.h new file mode 100644 index 00000000000..e32bda2e44c --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/logger.h @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef _LOGGER_H__ +#define __LOGGER_H__ + +#include "npupp.h" +#include "format.h" +#include "logfile.h" + +#define TOTAL_NUMBER_OF_API_CALLS 37 +#define DEFAULT_LOG_FILE_NAME "spylog.txt" + +class Logger +{ +public: + BOOL bMutedAll; + BOOL bToWindow; + BOOL bToConsole; + BOOL bToFile; + BOOL bOnTop; + BOOL bSPALID; //ShutdownPluginAfterLastInstanceDestroyed + // as opposed to 'only when NS asks to' + CLogFile filer; + + BOOL bSaveSettings; + char szFile[_MAX_PATH]; + + // 37 is the total number of API calls + // (NPN_* and NPP_* only, NPP_Initialize and NPP_Shutdown not included) + BOOL bMutedCalls[TOTAL_NUMBER_OF_API_CALLS]; + +public: + Logger(); + ~Logger(); + + BOOL init(); + void shut(); + + // platform dependent virtuals + virtual BOOL platformInit() = 0; + virtual void platformShut() = 0; + virtual void dumpStringToMainWindow(char * string) = 0; + + void setOnTop(BOOL ontop); + void setToFile(BOOL tofile, char * filename); + + BOOL * getMutedCalls(); + void setMutedCalls(BOOL * mutedcalls); + + BOOL isMuted(NPAPI_Action action); + + void logNS_NP_GetEntryPoints(); + void logNS_NP_Initialize(); + void logNS_NP_Shutdown(); + + void logSPY_NP_GetEntryPoints(NPPluginFuncs * pNPPFuncs); + void logSPY_NP_Initialize(); + void logSPY_NP_Shutdown(char * mimetype); + + void logCall(NPAPI_Action action, DWORD dw1 = 0L, DWORD dw2 = 0L, + DWORD dw3 = 0L, DWORD dw4 = 0L, DWORD dw5 = 0L, DWORD dw6 = 0L, DWORD dw7 = 0L); + void logReturn(DWORD dwRet = 0L); +}; + +Logger * NewLogger(); +void DeleteLogger(Logger * logger); + +#endif diff --git a/mozilla/modules/plugin/npspy/include/plugload.h b/mozilla/modules/plugin/npspy/include/plugload.h new file mode 100644 index 00000000000..bc8a0aa7018 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/plugload.h @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PLUGLOAD_H__ +#define __PLUGLOAD_H__ + +DWORD GetPluginsDir(char * path, DWORD maxsize); +XP_HLIB LoadRealPlugin(char * mimetype); +void UnloadRealPlugin(XP_HLIB hLib); + +#endif diff --git a/mozilla/modules/plugin/npspy/include/profile.h b/mozilla/modules/plugin/npspy/include/profile.h new file mode 100644 index 00000000000..b567ba84503 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/profile.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PROFILE_H__ +#define __PROFILE_H__ + +class Profile +{ +public: + Profile(); + ~Profile(); + + virtual BOOL getBool(char * key, BOOL * value) = 0; + virtual BOOL setBool(char * key, BOOL value) = 0; + + virtual BOOL getString(char * key, char * string, int size) = 0; + virtual BOOL setString(char * key, char * string) = 0; +}; + +#endif diff --git a/mozilla/modules/plugin/npspy/include/setup.h b/mozilla/modules/plugin/npspy/include/setup.h new file mode 100644 index 00000000000..05b37456ba2 --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/setup.h @@ -0,0 +1,6 @@ +#ifndef __SETUP_H__ +#define __SETUP_H__ + +void WINAPI SPY_Setup(); + +#endif diff --git a/mozilla/modules/plugin/npspy/include/xp.h b/mozilla/modules/plugin/npspy/include/xp.h new file mode 100644 index 00000000000..3fc867148de --- /dev/null +++ b/mozilla/modules/plugin/npspy/include/xp.h @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __XP_H__ +#define __XP_H__ + +/*****************************************************/ + +#ifdef XP_WIN + + #include + +#endif + +/*****************************************************/ + + +#ifdef XP_MAC + #include +#endif + +#if (defined XP_MAC || defined XP_UNIX) + + typedef unsigned char BYTE; + + #define strcmpi strcmp + +#endif + + +/*****************************************************/ + +#ifdef XP_UNIX + #include + #include /* strcat() */ + #include /* stat() */ + #include + #include /* atoi() */ + #include /* assert() */ + #include /* isprint() */ + + #ifndef FALSE + #define FALSE false + #endif + + #ifndef TRUE + #define TRUE true + #endif + + #ifndef HIBYTE + #define HIBYTE(x) ((((u_int)(x)) & 0xff00)>>8) + #endif + + #ifndef LOBYTE + #define LOBYTE(x) (((u_int)(x)) & 0x00ff) + #endif + + #ifndef XP_EXPORT_API + #define XP_EXPORT_API + #endif + +#endif + +/*****************************************************/ + +#ifdef XP_WIN + + #define XP_HFILE HFILE + #define XP_HLIB HINSTANCE + + #define XP_EXPORT_API WINAPI + +#else + + #define XP_HFILE FILE* + + #ifndef DWORD + #define DWORD unsigned long + #endif + + #ifndef UINT + #define UINT unsigned int + #endif + + #ifndef WORD + #define WORD unsigned short + #endif + + #ifndef BOOL + #define BOOL bool + #endif + + #if (defined XP_UNIX) /* For IRIX */ + #ifndef bool + #define bool unsigned char + #endif + #endif + +#endif + + + +/*****************************************************/ + +#ifndef _MAX_PATH + #define _MAX_PATH 256 +#endif + +/*****************************************************/ + +// File utilities +BOOL XP_IsFile(char * szFileName); +XP_HFILE XP_CreateFile(char * szFileName); +XP_HFILE XP_OpenFile(char * szFileName); +void XP_CloseFile(XP_HFILE hFile); +void XP_DeleteFile(char * szFileName); +DWORD XP_WriteFile(XP_HFILE hFile, void * pBuf, int iSize); +void XP_FlushFileBuffers(XP_HFILE hFile); + +#endif diff --git a/mozilla/modules/plugin/npspy/windows/dirpick.cpp b/mozilla/modules/plugin/npspy/windows/dirpick.cpp new file mode 100644 index 00000000000..b9c0f7f11b9 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/dirpick.cpp @@ -0,0 +1,589 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include +#include +#include +#include + +#include "resource.h" + +extern HINSTANCE hInst; + +#define ITEM_BITMAPWIDTH 16 +#define ITEM_BITMAPHEIGHT 16 +#define ITEM_LEFTMARGIN 4 +#define ITEM_GAP 4 + +static HWND hWndDirPicker; +static HICON hIconDrives[5]; +static HICON hIconFolders[3]; +static LPSTR lpszStringToReturn; +static char szUNCRoot[256] = ""; + +UINT DriveType(UINT iType); + +static void fillComboBox(HWND hWnd) +{ + HWND hWndCB = GetDlgItem(hWnd, ID_COMBO_DIR); + HWND hWndTempLB = GetDlgItem(hWnd, ID_LISTTEMP_DIR); + if(hWndCB == NULL) + return; + ComboBox_ResetContent(hWndCB); + ListBox_ResetContent(hWndTempLB); + ListBox_Dir(hWndTempLB, DDL_DRIVES|DDL_EXCLUSIVE, (LPSTR)"*"); + + int iDriveCount = ListBox_GetCount(hWndTempLB); + int iCurDrive=_getdrive() - 1; + + char szDrive[16]; + char szItem[80]; + + for (int i = 0; i < iDriveCount; i++) + { + ListBox_GetText(hWndTempLB, i, szDrive); + CharLower(szDrive); + int iDrive = szDrive[2] - 'a'; + char szRoot[16]; + sprintf(szRoot, "%c:\\", szDrive[2]); + + int iType = DriveType(iDrive); + + if(iType < 2) + continue; + + //Start the item string with the drive letter, colon, and two spaces + sprintf(szItem, "%c%s", szDrive[2], ": "); + + if((iType == DRIVE_FIXED) || (iType == DRIVE_RAMDISK)) + { // get volume ID + char szVolumeID[80]; + DWORD dwMaxLength; + DWORD dwSysFlags; + GetVolumeInformation(szRoot, // address of root directory of the file system + szVolumeID, // address of name of the volume + sizeof(szVolumeID), // length of lpVolumeNameBuffer + NULL, // address of volume serial number + &dwMaxLength, // address of system's maximum filename length + &dwSysFlags, // address of file system flags + NULL, // address of name of file system + NULL); // length of lpFileSystemNameBuffer + + CharLower(szVolumeID); + lstrcat(szItem, szVolumeID); + } + + //For network drives, go grab the \\server\share for it. + if(DRIVE_REMOTE == iType) + { + char szNet[64]; + szNet[0] = '\0'; + DWORD dwSizeOfszNet = sizeof(szNet); + + sprintf(szDrive, "%c:", szDrive[2]); + CharUpper(szDrive); + WNetGetConnection(szDrive, szNet, &dwSizeOfszNet); + CharLower(szNet); + lstrcat(szItem, szNet); + } + + int index = ComboBox_AddString(hWndCB, szItem); + ComboBox_SetItemData(hWndCB, index, MAKELONG(iDrive, iType)); + if(iDrive == iCurDrive) + ComboBox_SetCurSel(hWndCB, index); + if(szUNCRoot[0] != '\0') + ComboBox_SetCurSel(hWndCB, -1); + } +} + +static void fillTempLBWithDirs(HWND hWndTempLB, LPSTR lpszDir) +{ + BOOL bDone = FALSE; + WIN32_FIND_DATA ffdataStruct; + + char szPath[_MAX_PATH]; + char szFileName[_MAX_PATH]; + lstrcpy(szPath, lpszDir); + if(szPath[lstrlen(szPath) - 1] == '\\') + szPath[lstrlen(szPath) - 1] = '\0'; + lstrcpy(szFileName, szPath); + lstrcat(szFileName, "\\*"); + HANDLE handle = FindFirstFile(szFileName, &ffdataStruct); + if(handle == INVALID_HANDLE_VALUE) + { + FindClose(handle); + return; + } + while(!bDone) + { + lstrcpy(szFileName, szPath); + lstrcat(szFileName, "\\"); + lstrcat(szFileName, ffdataStruct.cFileName); + if(ffdataStruct. dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + char szStringToAdd[_MAX_PATH + 2]; + lstrcpy(szStringToAdd, "["); + lstrcat(szStringToAdd, ffdataStruct.cFileName); + lstrcat(szStringToAdd, "]"); + CharLower(szStringToAdd); + ListBox_AddString(hWndTempLB, szStringToAdd); + } + bDone = !FindNextFile(handle, &ffdataStruct); + } + FindClose(handle); +} + +static void fillListBox(HWND hWnd, LPSTR lpszDir) +{ + HWND hWndLB = GetDlgItem(hWnd, ID_LIST_DIR); + HWND hWndTempLB = GetDlgItem(hWnd, ID_LISTTEMP_DIR); + HWND hWndEdit = GetDlgItem(hWnd, ID_EDIT_DIR); + if((hWndLB == NULL) || (lpszDir == NULL)) + return; + + int iLastChar = lstrlen(lpszDir); + if(lpszDir[iLastChar - 1] == '\\') + lpszDir[iLastChar - 1] = '\0'; + + SetWindowRedraw(hWndLB, FALSE); + ListBox_ResetContent(hWndLB); + ListBox_ResetContent(hWndTempLB); + + LPSTR lpszLast; + lpszLast = CharLower(lpszDir); + + SetWindowText(hWndLB, lpszDir); + + char szDir[_MAX_DIR]; + char szFullDir[_MAX_DIR]; + sprintf(szFullDir, "%s", lpszDir); + sprintf(szDir, "%s\\*.*", lpszDir); + + BOOL bFirst = TRUE; + char ch; + int index; + while (TRUE) + { + LPSTR lpsz; + if((lpszDir[0] == '\\') && (lpszDir[1] == '\\') && bFirst) + lpsz = strchr(lpszLast + lstrlen(szUNCRoot), '\\'); + else + lpsz = strchr(lpszLast, '\\'); + if(lpsz != NULL) { + if (bFirst) + ch = *(++lpsz); + else + ch = *lpsz; + *lpsz = 0; + } + else + { + //If we're looking at a drive only, then append a backslash + if (lpszLast == lpszDir && bFirst) + lstrcat(lpszLast, "\\"); + } + //Add the drive string--includes the last one where lpsz == NULL + index = ListBox_AddString(hWndLB, lpszLast); + + UINT i = (NULL != lpsz) ? ID_ICON_FOLDEROPEN : ID_ICON_OPENSELECT; + ListBox_SetItemData(hWndLB, index, MAKELONG(index, i)); + + if(NULL == lpsz) + break; + + //Restore last character. + *lpsz = ch; + lpsz += (bFirst) ? 0 : 1; + + bFirst=FALSE; + lpszLast = lpsz; + } + int indent = index + 1; + + //Get available directories + fillTempLBWithDirs(hWndTempLB, lpszDir); + + int itemCount = ListBox_GetCount(hWndTempLB); + + for (int i = 0; i < itemCount; i++) { + index = ListBox_GetText(hWndTempLB, i, lpszDir); + //Skip directories beginning with . (skipping . and ..) + if(lpszDir[1] == '.') + continue; + //Remove the ending ']' + iLastChar = lstrlen(lpszDir); + lpszDir[iLastChar - 1] = '\0'; + //Add the string to the real directory list. + index = ListBox_AddString(hWndLB, lpszDir + 1); + ListBox_SetItemData(hWndLB, index, MAKELONG(indent, ID_ICON_FOLDERCLOSED)); + } + //Force a listbox repaint. + SetWindowRedraw(hWndLB, TRUE); + InvalidateRect(hWndLB, NULL, TRUE); + + if(szFullDir[lstrlen(szFullDir) - 1] == ':') + lstrcat(szFullDir, "\\"); + Edit_SetText(hWndEdit, szFullDir); + + GetScrollRange(hWndLB, SB_VERT, (LPINT)&i, (LPINT)&index); + + if(!(i == 0 && index == 0)) + ListBox_SetTopIndex(hWndLB, max((int)(index - 2), 0)); + + ListBox_SetCurSel(hWndLB, indent - 1); +} + +static void onDrawItem(LPDRAWITEMSTRUCT lpdis, BOOL bDrive) +{ + if((int)lpdis->itemID < 0) + return; + + char szItem[_MAX_DIR]; + DWORD dwItemData; + + if(bDrive) + { + dwItemData = ComboBox_GetItemData(lpdis->hwndItem, lpdis->itemID); + ComboBox_GetLBText(lpdis->hwndItem, lpdis->itemID, szItem); + } + else + { + dwItemData = ListBox_GetItemData(lpdis->hwndItem, lpdis->itemID); + ListBox_GetText(lpdis->hwndItem, lpdis->itemID, szItem); + } + + if(lpdis->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) + { + COLORREF colorText; + COLORREF colorBack; + if(lpdis->itemState & ODS_SELECTED) + { + colorText = SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + colorBack = SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); + } + HICON hIcon; + int indent = 0; + if(bDrive) + { + int iType=(int)HIWORD(dwItemData); + switch (iType) + { + case DRIVE_REMOVABLE: + hIcon = hIconDrives[0]; + break; + case DRIVE_FIXED: + hIcon = hIconDrives[1]; + break; + case DRIVE_REMOTE: + hIcon = hIconDrives[2]; + break; + case DRIVE_CDROM: + hIcon = hIconDrives[3]; + break; + case DRIVE_RAMDISK: + hIcon = hIconDrives[4]; + break; + } + + } + else + { + int iconID = (int)HIWORD(lpdis->itemData); + switch (iconID) + { + case ID_ICON_FOLDERCLOSED: + hIcon = hIconFolders[0]; + break; + case ID_ICON_FOLDEROPEN: + hIcon = hIconFolders[1]; + break; + case ID_ICON_OPENSELECT: + hIcon = hIconFolders[2]; + break; + } + indent = 4 * (1 + LOWORD(lpdis->itemData)); + } + + ExtTextOut(lpdis->hDC, + lpdis->rcItem.left + ITEM_LEFTMARGIN + ITEM_BITMAPWIDTH + ITEM_GAP + indent, + lpdis->rcItem.top, + ETO_OPAQUE | ETO_CLIPPED, + &lpdis->rcItem, + szItem, + lstrlen(szItem), + NULL); + + BOOL res = DrawIcon(lpdis->hDC, + lpdis->rcItem.left + ITEM_LEFTMARGIN + indent, + lpdis->rcItem.top, + hIcon); + + if(lpdis->itemState & ODS_SELECTED) + { + SetTextColor(lpdis->hDC, colorText); + SetBkColor(lpdis->hDC, colorBack); + } + } + if((lpdis->itemAction & ODA_FOCUS) || (lpdis->itemState & ODS_FOCUS)) + DrawFocusRect(lpdis->hDC, &lpdis->rcItem); +} + +static void fillUNCRootArray(LPSTR lpsz) +{ + char szCurDir[_MAX_PATH]; + _getcwd(szCurDir, sizeof(szCurDir)); + lstrcpy(szUNCRoot, lpsz); + if(szUNCRoot[lstrlen(szUNCRoot) - 1] == '\\') + szUNCRoot[lstrlen(szUNCRoot) - 1] = '\0'; + for(;;) + { + LPSTR lptemp = strrchr(szUNCRoot, '\\'); + if(lptemp == NULL) + break; + *lptemp = '\0'; + if(_chdir(szUNCRoot) == -1) + { + *lptemp = '\\'; + break; + } + } + _chdir(szCurDir); +} + +static void onInitDialog(HWND hWnd, LPSTR lpsz) +{ + hWndDirPicker = hWnd; + lpszStringToReturn = lpsz; + + hIconDrives[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEFLOPPY)); + hIconDrives[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEHARD)); + hIconDrives[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVENETWORK)); + hIconDrives[3] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVECDROM)); + hIconDrives[4] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVERAM)); + + hIconFolders[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDERCLOSED)); + hIconFolders[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDEROPEN)); + hIconFolders[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_OPENSELECT)); + + if(lpsz[0] == '\0') + _getcwd(lpsz, _MAX_PATH); + else if(lpsz[lstrlen(lpsz) - 1] == ':') + lstrcat(lpsz, "\\"); + + int ret = _chdir(lpsz); + if(ret == -1) + { + char szText[_MAX_PATH + 80]; + sprintf(szText, "The specified directory %s\ncannot be found", lpsz); + MessageBox(GetParent(hWnd), szText, "Choose Directory", MB_ICONEXCLAMATION|MB_OK); + _getcwd(lpsz, _MAX_PATH); + } + if((lpsz[0] == '\\') && (lpsz[1] == '\\')) + fillUNCRootArray(lpsz); + fillListBox(hWnd, lpsz); + fillComboBox(hWnd); +} + +static void shutDialog(HWND hWnd) +{ + szUNCRoot[0] = '\0'; +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + char szCurDir[_MAX_PATH]; + switch(id) + { + case ID_LIST_DIR: + if(codeNotify == LBN_DBLCLK) + { + int index = ListBox_GetCurSel(hWndCtl); + DWORD dwItemData = ListBox_GetItemData(hWndCtl, index); + + if(HIWORD(dwItemData) == ID_ICON_OPENSELECT) + { + shutDialog(hWnd); + char szString[_MAX_PATH]; + Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString)); + lstrcpy(lpszStringToReturn, szString); + EndDialog(hWnd, IDOK); + break; + } + + ListBox_GetText(hWndCtl, index, szCurDir); + + char szDir[_MAX_DIR]; + LPSTR lpsz; + if((HIWORD(dwItemData) == ID_ICON_FOLDEROPEN) && (index != 0)) + { + GetWindowText(hWndCtl, szDir, sizeof(szDir)); + lpsz=_fstrstr(szDir, szCurDir); + *(lpsz + lstrlen(szCurDir)) = '\0'; + lstrcpy(szCurDir, szDir); + } + if (_chdir(szCurDir) == 0) + { + _getcwd(szCurDir, _MAX_PATH); + fillListBox(hWndDirPicker, szCurDir); + } + } + break; + case ID_COMBO_DIR: + if(codeNotify == CBN_SELCHANGE) + { + char szDrive[80]; + int index = ComboBox_GetCurSel(hWndCtl); + if(index == CB_ERR) + break; + ComboBox_GetLBText(hWndCtl, index, szDrive); + + int iCurDrive = _getdrive(); +Retry: + HCURSOR hCursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCapture(hWndDirPicker); + if((0 == _chdrive((int)(szDrive[0] - 'a' + 1))) && (NULL != _getcwd(szCurDir, _MAX_PATH))) + { + fillListBox(hWndDirPicker, szCurDir); + ListBox_SetTopIndex(GetDlgItem(hWndDirPicker, ID_LIST_DIR), 0); + SetCursor(hCursorOld); + ReleaseCapture(); + break; + } + SetCursor(hCursorOld); + ReleaseCapture(); + + char szText[80]; + sprintf(szText, "Cannot read drive %c:", szDrive[0]); + if(IDRETRY == MessageBox(hWndDirPicker, szText, "Choose Directory", MB_ICONEXCLAMATION|MB_RETRYCANCEL)) + goto Retry; + + //Changing drives failed so restore drive and selection + _chdrive(iCurDrive); + + sprintf(szDrive, "%c:", (char)(iCurDrive + 'a' - 1)); + index = ComboBox_SelectString(hWndCtl, -1, szDrive); + } + break; + case IDOK: + shutDialog(hWnd); + char szString[_MAX_PATH]; + Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString)); + lstrcpy(lpszStringToReturn, szString); + EndDialog(hWnd, IDOK); + break; + case IDCANCEL: + shutDialog(hWnd); + lpszStringToReturn[0] = '\0'; + EndDialog(hWnd, IDCANCEL); + break; + default: + break; + } +} + +static BOOL CALLBACK DirPickDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_INITDIALOG: + onInitDialog(hWnd, (LPSTR)lParam); + break; + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_MEASUREITEM: + { + static int cyItem = -1; //Height of a listbox item + LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam; + if(cyItem == -1) + { + HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0L); + if(hFont == NULL) + hFont = GetStockFont(SYSTEM_FONT); + HDC hDC = GetDC(hWnd); + HFONT hFontOld = SelectFont(hDC, hFont); + TEXTMETRIC tm; + GetTextMetrics(hDC, &tm); + cyItem = max(ITEM_BITMAPHEIGHT, tm.tmHeight); + SelectFont(hDC, hFontOld); + ReleaseDC(hWnd, hDC); + } + + lpmis->itemHeight = cyItem; + } + break; + case WM_DRAWITEM: + onDrawItem((LPDRAWITEMSTRUCT)lParam, ((UINT)wParam == ID_COMBO_DIR)); + return TRUE; // to prevent default action in listbox (drawing focus) + default: + return FALSE; + } + return TRUE; +} + +/* + * DriveType + * + * Purpose: + * Augments the Windows API GetDriveType with a call to the CD-ROM + * extensions to determine if a drive is a floppy, hard disk, CD-ROM, + * RAM-drive, or networked drive. + * + * Parameters: + * iDrive UINT containing the zero-based drive index + * + * Return Value: + * UINT One of the following values describing the drive: + * DRIVE_FLOPPY, DRIVE_HARD, DRIVE_CDROM, DRIVE_RAMDISK, + * DRIVE_NETWORK. + * + * Copyright (c)1992 Kraig Brockschmidt, All Right Reserved + * Compuserve: 70750,2344 + * Internet : kraigb@microsoft.com + * + */ +UINT DriveType(UINT iDrive) +{ + //Validate possible drive indices + if((0 > iDrive) || (25 < iDrive)) + return (UINT)-1; + + static char path[] = "d:\\"; + path[0] = 'a' + iDrive; + int iType = GetDriveType(path); + + /* + * Under Windows NT, GetDriveType returns complete information + * not provided under Windows 3.x which we now get through other + * means. + */ + + return iType; +} + +BOOL PickupDirectory(HWND hWndOwner, LPSTR lpszString) +{ + if(hWndOwner == NULL) + hWndOwner = GetDesktopWindow(); + int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(ID_DIALOG_CHOOSEDIR), hWndOwner, DirPickDlgProc, (LPARAM)lpszString); + return (ret == IDOK); +} diff --git a/mozilla/modules/plugin/npspy/windows/gui_advanced.cpp b/mozilla/modules/plugin/npspy/windows/gui_advanced.cpp new file mode 100644 index 00000000000..da69be7d572 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_advanced.cpp @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bSPALID = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_SPALID)); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_SPALID, logger->bSPALID ? BST_CHECKED : BST_UNCHECKED); + } + + return TRUE; +} + +BOOL CALLBACK AdvancedPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/gui_fiter.cpp b/mozilla/modules/plugin/npspy/windows/gui_fiter.cpp new file mode 100644 index 00000000000..86b1759e313 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_fiter.cpp @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDC_BUTTON_CHECKALL: + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_CHECKED); + break; + } + case IDC_BUTTON_CLEARALL: + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_UNCHECKED); + break; + } + default: + break; + } +} + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + BOOL mutedcalls[TOTAL_NUMBER_OF_API_CALLS]; + + mutedcalls[0] = FALSE; // for invalid call + + // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + mutedcalls[i - IDC_CHECK_NPN_VERSION + 1] = (BST_UNCHECKED == IsDlgButtonChecked(hWnd, i)); + + logger->setMutedCalls(&mutedcalls[0]); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + BOOL * mutedcalls = logger->getMutedCalls(); + + if(mutedcalls) + { + // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, mutedcalls[i - IDC_CHECK_NPN_VERSION + 1] ? BST_UNCHECKED : BST_CHECKED); + } + else + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_CHECKED); + } + + return TRUE; +} + +BOOL CALLBACK FilterPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/gui_general.cpp b/mozilla/modules/plugin/npspy/windows/gui_general.cpp new file mode 100644 index 00000000000..9073cd866ea --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_general.cpp @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bOnTop = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_ONTOP)); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_ONTOP, logger->bOnTop ? BST_CHECKED : BST_UNCHECKED); + } + + return TRUE; +} + +BOOL CALLBACK GeneralPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/gui_log.cpp b/mozilla/modules/plugin/npspy/windows/gui_log.cpp new file mode 100644 index 00000000000..f2cbcf29f9f --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_log.cpp @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" +#include "dirpick.h" + +static void onChooseDir(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + char string[_MAX_PATH]; + char name[_MAX_PATH]; + + GetDlgItemText(hWnd, IDC_EDIT_FILE, string, strlen(string)); + char * p = NULL; + p = strrchr(string, '\\'); + if(p) + { + strcpy(name, p); + *p = '\0'; + } + + if(PickupDirectory(hWnd, string)) + { + //check the last character for being '\' + if(string[strlen(string) - 1] == '\\') + string[strlen(string) - 1] = '\0'; + + if(p) + strcat(string, name); + else + { + strcat(string, "\\"); + strcat(string, DEFAULT_LOG_FILE_NAME); + } + SetDlgItemText(hWnd, IDC_EDIT_FILE, string); + } +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDC_CHECK_TOFILE: + EnableWindow(GetDlgItem(hWnd, IDC_EDIT_FILE), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + EnableWindow(GetDlgItem(hWnd, IDC_BUTTON_CHOOSEDIR), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + break; + case IDC_BUTTON_CHOOSEDIR: + onChooseDir(hWnd); + break; + default: + break; + } +} + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bToWindow = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOWINDOW)); + logger->bToConsole = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOCONSOLE)); + + char filename[_MAX_PATH]; + GetDlgItemText(hWnd, IDC_EDIT_FILE, filename, strlen(filename)); + logger->setToFile(BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE), filename); + + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_TOWINDOW, logger->bToWindow ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_CHECK_TOCONSOLE, logger->bToConsole ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_CHECK_TOFILE, logger->bToFile ? BST_CHECKED : BST_UNCHECKED); + + SetDlgItemText(hWnd, IDC_EDIT_FILE, logger->szFile); + EnableWindow(GetDlgItem(hWnd, IDC_EDIT_FILE), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + EnableWindow(GetDlgItem(hWnd, IDC_BUTTON_CHOOSEDIR), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + } + + return TRUE; +} + +BOOL CALLBACK LogPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/gui_main.cpp b/mozilla/modules/plugin/npspy/windows/gui_main.cpp new file mode 100644 index 00000000000..81e60ae51f9 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_main.cpp @@ -0,0 +1,291 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "resource.h" +#include "loggerw.h" +#include "profilew.h" + +extern HINSTANCE hInst; +extern char * ActionName[]; +extern char szAppName[]; + +BOOL CALLBACK GeneralPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK LogPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK FilterPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK AdvancedPageProc(HWND, UINT, WPARAM, LPARAM); + +static void onOptions(HWND hWnd, Logger * logger) +{ + if(!logger) + return; + + PROPSHEETPAGE psp[4]; + + psp[0].dwSize = sizeof(psp[0]); + psp[0].dwFlags = PSP_DEFAULT; + psp[0].hInstance = hInst; + psp[0].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_GENERAL); + psp[0].pszIcon = 0; + psp[0].pfnDlgProc = GeneralPageProc; + psp[0].pszTitle = 0; + psp[0].lParam = (LPARAM)logger; + psp[0].pfnCallback = NULL; + + psp[1].dwSize = sizeof(psp[1]); + psp[1].dwFlags = PSP_DEFAULT; + psp[1].hInstance = hInst; + psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_LOG); + psp[1].pszIcon = 0; + psp[1].pfnDlgProc = LogPageProc; + psp[1].pszTitle = 0; + psp[1].lParam = (LPARAM)logger; + psp[1].pfnCallback = NULL; + + psp[2].dwSize = sizeof(psp[2]); + psp[2].dwFlags = PSP_DEFAULT; + psp[2].hInstance = hInst; + psp[2].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_FILTER); + psp[2].pszIcon = 0; + psp[2].pfnDlgProc = FilterPageProc; + psp[2].pszTitle = 0; + psp[2].lParam = (LPARAM)logger; + psp[2].pfnCallback = NULL; + + psp[3].dwSize = sizeof(psp[3]); + psp[3].dwFlags = PSP_DEFAULT; + psp[3].hInstance = hInst; + psp[3].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_ADVANCED); + psp[3].pszIcon = 0; + psp[3].pfnDlgProc = AdvancedPageProc; + psp[3].pszTitle = 0; + psp[3].lParam = (LPARAM)logger; + psp[3].pfnCallback = NULL; + + PROPSHEETHEADER psh; + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; + psh.hwndParent = hWnd; + psh.hInstance = hInst; + psh.pszIcon = 0; + psh.pszCaption = "Settings"; + psh.nPages = sizeof(psp) / sizeof(psp[0]); + psh.nStartPage = 0; + psh.ppsp = psp; + psh.pfnCallback = NULL; + + logger->bSaveSettings = FALSE; + + int rv = PropertySheet(&psh); + if(rv == -1) + return; + + if(logger->bSaveSettings) + { + ProfileWin profile; + + if(hWnd != NULL) + { + RECT rc; + if(GetWindowRect(hWnd, &rc)) + profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); + } + + profile.setBool(NPSPY_REG_KEY_ONTOP, logger->bOnTop); + profile.setBool(NPSPY_REG_KEY_LOGTOWINDOW, logger->bToWindow); + profile.setBool(NPSPY_REG_KEY_LOGTOCONSOLE, logger->bToConsole); + profile.setBool(NPSPY_REG_KEY_LOGTOFILE, logger->bToFile); + profile.setBool(NPSPY_REG_KEY_SPALID, logger->bSPALID); + profile.setString(NPSPY_REG_KEY_LOGFILENAME, logger->szFile); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + profile.setBool(ActionName[i], !logger->bMutedCalls[i]); + + SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + } + + logger->bSaveSettings = FALSE; +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER); + switch (id) + { + case IDC_CHECK_MUTE: + if(logger) + logger->bMutedAll = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_MUTE)); + break; + case IDC_BUTTON_OPTIONS: + onOptions(hWnd, logger); + break; + case IDC_BUTTON_CLEAR: + if(logger) + logger->onClear(); + break; + default: + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + LoggerWin * logger = (LoggerWin *)lParam; + SetWindowLong(hWnd, DWL_USER, (long)logger); + SetWindowText(hWnd, szAppName); + HFONT hFont = GetStockFont(ANSI_FIXED_FONT); + SetWindowFont(GetDlgItem(hWnd, IDC_MAIN_OUTPUT), hFont, FALSE); + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_MUTE, logger->bMutedAll ? BST_CHECKED : BST_UNCHECKED); + if(logger->width && logger->height) + SetWindowPos(hWnd, NULL, logger->x, logger->y, logger->width, logger->height, SWP_NOZORDER); + + SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); + } + return TRUE; +} + +static void onDestroy(HWND hWnd) +{ + LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER); + if(logger) + logger->onDestroyWindow(); +} + +static void onSize(HWND hWnd, UINT state, int cx, int cy) +{ + long bu = GetDialogBaseUnits(); + int bux = LOWORD(bu); + int buy = HIWORD(bu); + int factorx = bux/4; + int factory = buy/8; + + int marginLeft = 7 * factorx; + int marginRight = 0 * factorx; + int marginTop = 0 * factory; + int marginBottom = 7 * factory; + int spaceHor = 4 * factorx; + int spaceVer = 7 * factory; + + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + HWND hWndCheckMute = GetDlgItem(hWnd, IDC_CHECK_MUTE); + HWND hWndCheckOntop = GetDlgItem(hWnd, IDC_CHECK_ONTOP); + HWND hWndButtonOptions = GetDlgItem(hWnd, IDC_BUTTON_OPTIONS); + HWND hWndClear = GetDlgItem(hWnd, IDC_BUTTON_CLEAR); + + RECT rcMain; + GetClientRect(hWnd, &rcMain); + + int width = rcMain.right - rcMain.left; + int height = rcMain.bottom - rcMain.top; + + RECT rcButtonOptions; + GetWindowRect(hWndButtonOptions, &rcButtonOptions); + SetWindowPos(hWndButtonOptions, NULL, + width - marginLeft - rcButtonOptions.right + rcButtonOptions.left, + height - rcButtonOptions.bottom + rcButtonOptions.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcClear; + GetWindowRect(hWndClear, &rcClear); + SetWindowPos(hWndClear, NULL, + width - marginLeft - rcClear.right + rcClear.left - rcButtonOptions.right + rcButtonOptions.left - spaceHor, + height - rcClear.bottom + rcClear.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcCheckMute; + GetWindowRect(hWndCheckMute, &rcCheckMute); + SetWindowPos(hWndCheckMute, NULL, + marginLeft, + height - rcCheckMute.bottom + rcCheckMute.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcCheckOntop; + GetWindowRect(hWndCheckOntop, &rcCheckOntop); + SetWindowPos(hWndCheckOntop, NULL, + marginLeft + rcCheckMute.right - rcCheckMute.left + spaceHor, + height - rcCheckOntop.bottom + rcCheckOntop.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + SetWindowPos(hWndOutput, NULL, + 0, 0, + width, + height - rcButtonOptions.bottom + rcButtonOptions.top - marginBottom - marginTop - spaceVer, + SWP_NOZORDER | SWP_NOMOVE); + + // somehow the Clear button doesn't redraw itself well, so force it + InvalidateRect(hWndClear, NULL, TRUE); + UpdateWindow(hWndClear); +} + +BOOL CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_CLOSE: + DestroyWindow(hWnd); + break; + case WM_DESTROY: + HANDLE_WM_DESTROY(hWnd, wParam, lParam, onDestroy); + break; + case WM_SIZE: + HANDLE_WM_SIZE(hWnd, wParam, lParam, onSize); + break; + + default: + return FALSE; + } + return TRUE; +} + +// This is exported function which allows to access Settings GUI from other applications +void WINAPI SPY_Setup() +{ + LoggerWin logger; + ProfileWin profile; + + profile.getBool(NPSPY_REG_KEY_ONTOP, &logger.bOnTop); + profile.getBool(NPSPY_REG_KEY_LOGTOWINDOW, &logger.bToWindow); + profile.getBool(NPSPY_REG_KEY_LOGTOCONSOLE, &logger.bToConsole); + profile.getBool(NPSPY_REG_KEY_LOGTOFILE, &logger.bToFile); + profile.getBool(NPSPY_REG_KEY_SPALID, &logger.bSPALID); + profile.getString(NPSPY_REG_KEY_LOGFILENAME, logger.szFile, strlen(logger.szFile)); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + { + BOOL selected = TRUE; + if(profile.getBool(ActionName[i], &selected)) + logger.bMutedCalls[i] = !selected; + } + + onOptions(NULL, &logger); +} \ No newline at end of file diff --git a/mozilla/modules/plugin/npspy/windows/gui_pause.cpp b/mozilla/modules/plugin/npspy/windows/gui_pause.cpp new file mode 100644 index 00000000000..f4f899a4dd2 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/gui_pause.cpp @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "resource.h" + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDOK: + EndDialog(hWnd, IDOK); + break; + case IDCANCEL: + EndDialog(hWnd, IDCANCEL); + break; + default: + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + SetWindowPos(hWnd, NULL, 0,0,0,0, SWP_NOZORDER); + return TRUE; +} + +BOOL CALLBACK PauseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_CLOSE: + EndDialog(hWnd, IDCANCEL); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/loggerw.cpp b/mozilla/modules/plugin/npspy/windows/loggerw.cpp new file mode 100644 index 00000000000..64e961169d4 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/loggerw.cpp @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include "windowsx.h" + +#include "resource.h" +#include "loggerw.h" +#include "profilew.h" +#include "actionnames.h" + +extern HINSTANCE hInst; +static char szClassName[] = "NPSpyWindowClass"; + +BOOL CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK PauseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + +LoggerWin::LoggerWin() : Logger(), + hWnd(NULL), + width(0), + height(0), + x(0), + y(0), + bSaveSettings(FALSE) +{ +} + +LoggerWin::~LoggerWin() +{ +} + +BOOL LoggerWin::platformInit() +{ + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInst; + wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; + + // restore prefs + ProfileWin profile; + + profile.getBool(NPSPY_REG_KEY_ONTOP, &bOnTop); + profile.getBool(NPSPY_REG_KEY_LOGTOWINDOW, &bToWindow); + profile.getBool(NPSPY_REG_KEY_LOGTOCONSOLE, &bToConsole); + profile.getBool(NPSPY_REG_KEY_LOGTOFILE, &bToFile); + profile.getBool(NPSPY_REG_KEY_SPALID, &bSPALID); + profile.getString(NPSPY_REG_KEY_LOGFILENAME, szFile, strlen(szFile)); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + { + BOOL selected = TRUE; + if(profile.getBool(ActionName[i], &selected)) + bMutedCalls[i] = !selected; + } + + if(!profile.getSizeAndPosition(&width, &height, &x, &y)) + { + width = 0; + height = 0; + x = 0; + y = 0; + } + + hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG_MAIN), GetDesktopWindow(), (DLGPROC)MainDlgProc, (LPARAM)this); + if(hWnd == NULL) + { + UnregisterClass(szClassName, hInst); + return FALSE; + } + + if(bOnTop) + SetWindowPos(hWnd, bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); + + return TRUE; +} + +void LoggerWin::platformShut() +{ + if(hWnd != NULL) + { + char szLog[] = "--- GOING AWAY... PRESS SPACE BAR TO CONTINUE ---"; + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_AddString(hWndOutput, ""); + ListBox_AddString(hWndOutput, szLog); + int count = ListBox_GetCount(hWndOutput); + ListBox_SetCaretIndex(hWndOutput, count - 1); + UpdateWindow(hWndOutput); + + DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_PAUSE), hWnd, (DLGPROC)PauseDlgProc); + + ProfileWin profile; + + RECT rc; + if(GetWindowRect(hWnd, &rc)) + profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); + + DestroyWindow(hWnd); + hWnd = NULL; + } + + UnregisterClass(szClassName, hInst); +} + +void LoggerWin::onDestroyWindow() +{ + hWnd = NULL; +} + +void LoggerWin::dumpStringToMainWindow(char * string) +{ + // listboxes don't want and so cut them off if any. The order is important. + char * p = strrchr(string, '\n'); + if(p) + *p = '\0'; + + p = strrchr(string, '\r'); + if(p) + *p = '\0'; + + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_AddString(hWndOutput, string); + int count = ListBox_GetCount(hWndOutput); + if(count == 32767) + ListBox_ResetContent(hWndOutput); + ListBox_SetCaretIndex(hWndOutput, count - 1); + UpdateWindow(hWndOutput); +} + +void LoggerWin::onClear() +{ + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_ResetContent(hWndOutput); + UpdateWindow(hWndOutput); +} + +Logger * NewLogger() +{ + LoggerWin * res = new LoggerWin(); + return res; +} + +void DeleteLogger(Logger * logger) +{ + if(logger) + delete logger; +} \ No newline at end of file diff --git a/mozilla/modules/plugin/npspy/windows/loggerw.h b/mozilla/modules/plugin/npspy/windows/loggerw.h new file mode 100644 index 00000000000..801ca3cdda9 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/loggerw.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __LOGGRERW_H__ +#define __LOGGRERW_H__ + +#include "logger.h" + +class LoggerWin : public Logger +{ +public: + HWND hWnd; + int width; + int height; + int x; + int y; + BOOL bSaveSettings; + + LoggerWin(); + ~LoggerWin(); + + BOOL platformInit(); + void platformShut(); + void dumpStringToMainWindow(char * string); + + void onDestroyWindow(); + void onClear(); +}; + +#endif diff --git a/mozilla/modules/plugin/npspy/windows/npspy.def b/mozilla/modules/plugin/npspy/windows/npspy.def new file mode 100644 index 00000000000..910e72038cb --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/npspy.def @@ -0,0 +1,29 @@ +; -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +; +; The contents of this file are subject to the Netscape Public +; License Version 1.1 (the "License"); you may not use this file +; except in compliance with the License. You may obtain a copy of +; the License at http://www.mozilla.org/NPL/ +; +; Software distributed under the License is distributed on an "AS +; IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +; implied. See the License for the specific language governing +; rights and limitations under the License. +; +; The Original Code is mozilla.org code. +; +; The Initial Developer of the Original Code is Netscape +; Communications Corporation. Portions created by Netscape are +; Copyright (C) 1998 Netscape Communications Corporation. All +; Rights Reserved. +; +; Contributor(s): +; + +LIBRARY NPSPY + +EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 + SPY_Setup @4 \ No newline at end of file diff --git a/mozilla/modules/plugin/npspy/windows/npspy.dsp b/mozilla/modules/plugin/npspy/windows/npspy.dsp new file mode 100644 index 00000000000..9b8c3b6d462 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/npspy.dsp @@ -0,0 +1,278 @@ +# Microsoft Developer Studio Project File - Name="npspy" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=npspy - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "npspy.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "npspy.mak" CFG="npspy - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "npspy - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "npspy - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "npspy - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 + +!ELSEIF "$(CFG)" == "npspy - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\..\..\dist\include" /I "..\..\..\..\dist\win32_d.obj\include" /D "XP_WIN" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib version.lib advapi32.lib comctl32.lib mpr.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\..\dist\WIN32_D.OBJ\bin\plugins\npspy.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "npspy - Win32 Release" +# Name "npspy - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\dirpick.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\epmanager.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\fileutils.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\format.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_advanced.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_fiter.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_general.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_log.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_main.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_pause.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\logfile.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\logger.cpp +# End Source File +# Begin Source File + +SOURCE=.\loggerw.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\np_entry.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\npn_gate.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\npp_gate.cpp +# End Source File +# Begin Source File + +SOURCE=.\npspy.def +# End Source File +# Begin Source File + +SOURCE=.\npspy.rc +# End Source File +# Begin Source File + +SOURCE=..\common\plugload.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\profile.cpp +# End Source File +# Begin Source File + +SOURCE=.\profilew.cpp +# End Source File +# Begin Source File + +SOURCE=.\winentry.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\include\actionnames.h +# End Source File +# Begin Source File + +SOURCE=..\include\dirpick.h +# End Source File +# Begin Source File + +SOURCE=..\include\epmanager.h +# End Source File +# Begin Source File + +SOURCE=..\include\format.h +# End Source File +# Begin Source File + +SOURCE=..\include\logfile.h +# End Source File +# Begin Source File + +SOURCE=..\include\logger.h +# End Source File +# Begin Source File + +SOURCE=.\loggerw.h +# End Source File +# Begin Source File + +SOURCE=..\include\plugload.h +# End Source File +# Begin Source File + +SOURCE=..\include\profile.h +# End Source File +# Begin Source File + +SOURCE=.\profilew.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\windowsxx.h +# End Source File +# Begin Source File + +SOURCE=..\include\xp.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\cdrom.ico +# End Source File +# Begin Source File + +SOURCE=.\res\floppy.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldcl.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldop.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldopse.ico +# End Source File +# Begin Source File + +SOURCE=.\res\harddr.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon.ico +# End Source File +# Begin Source File + +SOURCE=.\res\netdr.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ramdr.ico +# End Source File +# End Group +# End Target +# End Project diff --git a/mozilla/modules/plugin/npspy/windows/npspy.dsw b/mozilla/modules/plugin/npspy/windows/npspy.dsw new file mode 100644 index 00000000000..8cc44e2378d --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/npspy.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "npspy"=.\npspy.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "spysetup"=.\spysetup.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/mozilla/modules/plugin/npspy/windows/npspy.rc b/mozilla/modules/plugin/npspy/windows/npspy.rc new file mode 100644 index 00000000000..e43992eccc0 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/npspy.rc @@ -0,0 +1,351 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "mozilla.org\0" + VALUE "FileDescription", "Spy plugin\0" + VALUE "FileExtents", "*\0" + VALUE "FileOpenName", "any name (*.*)\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SPYPLUGIN\0" + VALUE "LegalCopyright", "Copyright © 2001-\0" + VALUE "LegalTrademarks", "\0" + VALUE "MIMEType", "*\0" + VALUE "OriginalFilename", "NPSPY.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Mozilla Spy Plug-in\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // !_MAC + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG_MAIN DIALOG DISCARDABLE 0, 0, 322, 212 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU | WS_THICKFRAME +CAPTION "Dialog" +CLASS "NPSpyWindowClass" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_MAIN_OUTPUT,0,0,321,185,LBS_MULTIPLESEL | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP + CONTROL "&Mute",IDC_CHECK_MUTE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,195,32,10 + PUSHBUTTON "&Clear",IDC_BUTTON_CLEAR,209,191,50,14 + PUSHBUTTON "&Settings...",IDC_BUTTON_OPTIONS,263,191,50,14 +END + +IDD_DIALOG_PAUSE DIALOG DISCARDABLE 0, 0, 64, 29 +STYLE WS_POPUP +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,7,7,50,14 +END + +IDD_PAGE_GENERAL DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "General" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Always on &top",IDC_CHECK_ONTOP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,23,60,10 + GROUPBOX "Window",IDC_STATIC,7,7,224,32 +END + +IDD_PAGE_FILTER DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Filter" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Select calls to log",IDC_STATIC,7,7,224,232 + CONTROL "NPN_Version",IDC_CHECK_NPN_VERSION,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,22,59,10 + CONTROL "NPN_GetURLNotify",IDC_CHECK_NPN_GETURLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,32,79,10 + CONTROL "NPN_GetURL",IDC_CHECK_NPN_GETURL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,41,61,10 + CONTROL "NPN_PostURLNotify",IDC_CHECK_NPN_POSTURLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,51,82,10 + CONTROL "NPN_PostURL",IDC_CHECK_NPN_POSTURL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,61,64,10 + CONTROL "NPN_RequestRead",IDC_CHECK_NPN_REQUESTREAD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,70,79,10 + CONTROL "NPN_NewStream",IDC_CHECK_NPN_NEWSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,80,72,10 + CONTROL "NPN_Write",IDC_CHECK_NPN_WRITE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,89,52,10 + CONTROL "NPN_DestroyStream",IDC_CHECK_NPN_DESTROYSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,99,81,10 + CONTROL "NPN_Status",IDC_CHECK_NPN_STATUS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,109,55,10 + CONTROL "NPN_UserAgent",IDC_CHECK_NPN_ESERAGENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,118,69,10 + CONTROL "NPN_MemAlloc",IDC_CHECK_NPN_MEMALLOC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,128,66,10 + CONTROL "NPN_MemFree",IDC_CHECK_NPN_MEMFREE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,137,65,10 + CONTROL "NPN_MemFlush",IDC_CHECK_NPN_MEMFLUSH,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,147,67,10 + CONTROL "NPN_ReloadPlugins",IDC_CHECK_NPN_RELOADPLUGINS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,157,81,10 + CONTROL "NPN_GetJavaEnv",IDC_CHECK_NPN_GETJAVAENV,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,166,75,10 + CONTROL "NPN_GetJavaPeer",IDC_CHECK_NPN_GETJAVAPEER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,176,77,10 + CONTROL "NPN_GetValue",IDC_CHECK_NPN_GETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,185,65,10 + CONTROL "NPN_SetValue",IDC_CHECK_NPN_SETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,195,64,10 + CONTROL "NPN_InvalidateRect",IDC_CHECK_NPN_INVALIDATEREGION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,205,81,10 + CONTROL "NPN_InvalidateRegion",IDC_CHECK_NPNINVALIDATEREGION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,214,89,10 + CONTROL "NPN_ForceRedraw",IDC_CHECK_NPN_FORCEREDRAW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,224,78,10 + CONTROL "NPP_New",IDC_CHECK_NPP_NEW,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,22,49,10 + CONTROL "NPP_Destroy",IDC_CHECK_NPP_DESTROY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,32,59,10 + CONTROL "NPP_SetWindow",IDC_CHECK_NPP_SETWINDOW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,41,71,10 + CONTROL "NPP_NewStream",IDC_CHECK_NPP_NEWSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,51,71,10 + CONTROL "NPP_DestroyStream",IDC_CHECK_NPP_DESTROYSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,61,81,10 + CONTROL "NPP_StreamAsFile",IDC_CHECK_NPP_STREAMASFILE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,70,75,10 + CONTROL "NPP_Write",IDC_CHECK_NPP_WRITE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,80,51,10 + CONTROL "NPP_WriteReady",IDC_CHECK_NPP_WRITEREADY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,89,72,10 + CONTROL "NPP_Print",IDC_CHECK_NPP_PRINT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,99,49,10 + CONTROL "NPP_HandleEvent",IDC_CHECK_NPP_HANDLEEVENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,109,76,10 + CONTROL "NPP_URLNotify",IDC_CHECK_NPP_URLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,118,67,10 + CONTROL "NPP_GetJavaClass",IDC_CHECK_NPP_GETJAVACLASS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,128,78,10 + CONTROL "NPP_GetValue",IDC_CHECK_NPP_GETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,137,64,10 + CONTROL "NPP_SetValue",IDC_CHECK_NPP_SETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,147,63,10 + PUSHBUTTON "&Check All",IDC_BUTTON_CHECKALL,169,198,50,14 + PUSHBUTTON "C&lear All",IDC_BUTTON_CLEARALL,169,216,50,14 +END + +IDD_PAGE_LOG DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Log" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Choose where to output",IDC_STATIC,7,7,224,66 + CONTROL "To &window",IDC_CHECK_TOWINDOW,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,23,51,10 + CONTROL "To c&onsole",IDC_CHECK_TOCONSOLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,37,51,10 + CONTROL "To &file",IDC_CHECK_TOFILE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,51,35,10 + EDITTEXT IDC_EDIT_FILE,52,49,152,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BUTTON_CHOOSEDIR,206,49,19,14 +END + +IDD_PAGE_ADVANCED DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Advanced" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Shutdown immediately after the last instance destroyed", + IDC_CHECK_SPALID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 15,23,188,10 + GROUPBOX "Shutdown policy",IDC_STATIC,7,7,224,88 + LTEXT "Use this option to emulate 4.x behaviour when NP_Shutdown is called after the last plugin instance is destroyed. If this box is checked the Spy Plugin will call NP_Shutdown after NPP_Destroy is called on last instance.", + IDC_STATIC,15,39,209,33 + LTEXT "If this box is unchecked NP_Shutdown will be issued only when the Navigator commands so.", + IDC_STATIC,15,71,209,19 +END + +ID_DIALOG_CHOOSEDIR DIALOG DISCARDABLE 0, 0, 228, 143 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Choose Directory" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Directory &Name:",-1,7,9,55,8 + EDITTEXT ID_EDIT_DIR,7,20,151,13,ES_AUTOHSCROLL + LISTBOX ID_LIST_DIR,7,33,151,74,LBS_OWNERDRAWFIXED | + LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + LTEXT "Dri&ves:",-1,7,111,26,8 + COMBOBOX ID_COMBO_DIR,7,121,151,68,CBS_DROPDOWNLIST | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | + WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,171,9,50,14 + PUSHBUTTON "Cancel",IDCANCEL,171,27,50,14 + LISTBOX ID_LISTTEMP_DIR,181,53,20,40,LBS_SORT | + LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | + WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_DIALOG_MAIN, DIALOG + BEGIN + BOTTOMMARGIN, 205 + END + + IDD_DIALOG_PAUSE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 57 + TOPMARGIN, 7 + BOTTOMMARGIN, 22 + END + + IDD_PAGE_GENERAL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_FILTER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_LOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_ADVANCED, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON_APP ICON DISCARDABLE "res/icon.ico" +ID_ICON_DRIVECDROM ICON DISCARDABLE "res/cdrom.ICO" +ID_ICON_DRIVEFLOPPY ICON DISCARDABLE "res/floppy.ICO" +ID_ICON_DRIVEHARD ICON DISCARDABLE "res/harddr.ICO" +ID_ICON_DRIVENETWORK ICON DISCARDABLE "res/netdr.ICO" +ID_ICON_DRIVERAM ICON DISCARDABLE "res/ramdr.ICO" +ID_ICON_FOLDERCLOSED ICON DISCARDABLE "res/foldcl.ICO" +ID_ICON_FOLDEROPEN ICON DISCARDABLE "res/foldop.ICO" +ID_ICON_OPENSELECT ICON DISCARDABLE "res/foldopse.ICO" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/modules/plugin/npspy/windows/profilew.cpp b/mozilla/modules/plugin/npspy/windows/profilew.cpp new file mode 100644 index 00000000000..dfb79abcd5a --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/profilew.cpp @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include + +#include "profilew.h" + +ProfileWin::ProfileWin() : Profile() +{ + hKey = NULL; + char szClass[] = "SpyPluginClass"; + DWORD disp = 0L; + + LONG res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, + NPSPY_REG_SUBKEY, + 0L, + szClass, + 0L, + KEY_READ | KEY_WRITE, + NULL, + &hKey, + &disp); + + if(res != ERROR_SUCCESS) + hKey = NULL; +} + +ProfileWin::~ProfileWin() +{ + if(hKey) + RegCloseKey(hKey); +} + +BOOL ProfileWin::getBool(char * key, BOOL * value) +{ + if(!value) + return FALSE; + + DWORD size = sizeof(DWORD); + DWORD val = 1L; + LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)&val, &size); + + if(res != ERROR_SUCCESS) + return FALSE; + + *value = (val == 0L) ? FALSE : TRUE; + + return TRUE; +} + +BOOL ProfileWin::setBool(char * key, BOOL value) +{ + DWORD size = sizeof(DWORD); + DWORD val = value ? 1L : 0L; + LONG res = RegSetValueEx(hKey, key, 0L, REG_DWORD, (const BYTE *)&val, size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::getString(char * key, char * string, int size) +{ + LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)string, (DWORD *)&size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::setString(char * key, char * string) +{ + DWORD size = strlen(string); + LONG res = RegSetValueEx(hKey, key, 0L, REG_SZ, (const BYTE *)string, size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::getSizeAndPosition(int *width, int *height, int *x, int *y) +{ + DWORD size = sizeof(DWORD); + LONG res = ERROR_SUCCESS; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, NULL, (BYTE *)width, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, NULL, (BYTE *)height, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_X, 0L, NULL, (BYTE *)x, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_Y, 0L, NULL, (BYTE *)y, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + return TRUE; +} + +BOOL ProfileWin::setSizeAndPosition(int width, int height, int x, int y) +{ + DWORD size = sizeof(DWORD); + LONG res = ERROR_SUCCESS; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, REG_DWORD, (const BYTE *)&width, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, REG_DWORD, (const BYTE *)&height, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_X, 0L, REG_DWORD, (const BYTE *)&x, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_Y, 0L, REG_DWORD, (const BYTE *)&y, size); + if(res != ERROR_SUCCESS) + return FALSE; + + return TRUE; +} diff --git a/mozilla/modules/plugin/npspy/windows/profilew.h b/mozilla/modules/plugin/npspy/windows/profilew.h new file mode 100644 index 00000000000..ed673023ace --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/profilew.h @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PROFILEW_H__ +#define __PROFILEW_H__ + +#include "profile.h" + +class ProfileWin : public Profile +{ + HKEY hKey; + +public: + ProfileWin(); + ~ProfileWin(); + + BOOL getBool(char * key, BOOL * value); + BOOL setBool(char * key, BOOL value); + + BOOL getString(char * key, char * string, int size); + BOOL setString(char * key, char * string); + + BOOL getSizeAndPosition(int *width, int *height, int *x, int *y); + BOOL setSizeAndPosition(int width, int height, int x, int y); +}; + +#define NPSPY_REG_SUBKEY "Software\\Netscape\\SpyPlugin" + +#define NPSPY_REG_KEY_ONTOP "AlwaysOnTop" +#define NPSPY_REG_KEY_LOGTOWINDOW "LogToWindow" +#define NPSPY_REG_KEY_LOGTOCONSOLE "LogToConsole" +#define NPSPY_REG_KEY_LOGTOFILE "LogToFile" +#define NPSPY_REG_KEY_SPALID "ShutdownPluginsAfterDestroy" +#define NPSPY_REG_KEY_WIDTH "width" +#define NPSPY_REG_KEY_HEIGHT "height" +#define NPSPY_REG_KEY_X "x" +#define NPSPY_REG_KEY_Y "y" +#define NPSPY_REG_KEY_LOGFILENAME "LogFileName" + +#endif + diff --git a/mozilla/modules/plugin/npspy/windows/res/cdrom.ico b/mozilla/modules/plugin/npspy/windows/res/cdrom.ico new file mode 100644 index 00000000000..5e2821593e9 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/cdrom.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/floppy.ico b/mozilla/modules/plugin/npspy/windows/res/floppy.ico new file mode 100644 index 00000000000..b4209604ae0 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/floppy.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/foldcl.ico b/mozilla/modules/plugin/npspy/windows/res/foldcl.ico new file mode 100644 index 00000000000..cc2ff7f6239 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/foldcl.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/foldop.ico b/mozilla/modules/plugin/npspy/windows/res/foldop.ico new file mode 100644 index 00000000000..10e28405b05 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/foldop.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/foldopse.ico b/mozilla/modules/plugin/npspy/windows/res/foldopse.ico new file mode 100644 index 00000000000..c80112e3f31 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/foldopse.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/harddr.ico b/mozilla/modules/plugin/npspy/windows/res/harddr.ico new file mode 100644 index 00000000000..04fe5a5a493 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/harddr.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/icon.ico b/mozilla/modules/plugin/npspy/windows/res/icon.ico new file mode 100644 index 00000000000..dc53279e9b9 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/icon.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/netdr.ico b/mozilla/modules/plugin/npspy/windows/res/netdr.ico new file mode 100644 index 00000000000..f3387d22463 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/netdr.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/res/ramdr.ico b/mozilla/modules/plugin/npspy/windows/res/ramdr.ico new file mode 100644 index 00000000000..ac11f68ced3 Binary files /dev/null and b/mozilla/modules/plugin/npspy/windows/res/ramdr.ico differ diff --git a/mozilla/modules/plugin/npspy/windows/resource.h b/mozilla/modules/plugin/npspy/windows/resource.h new file mode 100644 index 00000000000..5a16757edbf --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/resource.h @@ -0,0 +1,91 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by npspy.rc +// +#define IDD_DIALOG_OPTIONS 101 +#define IDI_ICON1 102 +#define IDI_ICON_APP 102 +#define ID_DIALOG_CHOOSEDIR 102 +#define IDD_DIALOG_PAUSE 103 +#define ID_ICON_DRIVEFLOPPY 103 +#define IDD_PAGE_GENERAL 104 +#define ID_ICON_DRIVEHARD 104 +#define IDD_PAGE_FILTER 105 +#define ID_ICON_DRIVENETWORK 105 +#define IDD_PAGE_LOG 106 +#define ID_ICON_DRIVECDROM 106 +#define IDD_PAGE_ADVANCED 107 +#define ID_ICON_DRIVERAM 107 +#define ID_ICON_FOLDERCLOSED 108 +#define ID_ICON_FOLDEROPEN 109 +#define ID_ICON_OPENSELECT 110 +#define IDD_MAIN 308 +#define IDD_DIALOG_MAIN 308 +#define IDC_MAIN_OUTPUT 1001 +#define IDC_CHECK_NPN_VERSION 1002 +#define IDC_CHECK_NPN_GETURLNOTIFY 1003 +#define ID_EDIT_DIR 1003 +#define IDC_CHECK_NPNGETURL 1004 +#define IDC_CHECK_NPN_GETURL 1004 +#define ID_LIST_DIR 1004 +#define IDC_CHECK_NPN_POSTURLNOTIFY 1005 +#define ID_COMBO_DIR 1005 +#define IDC_CHECK_NPN_POSTURL 1006 +#define ID_LISTTEMP_DIR 1006 +#define IDC_CHECK_NPN_REQUESTREAD 1007 +#define IDC_CHECK_NPN_NEWSTREAM 1008 +#define IDC_CHECK_NPN_WRITE 1009 +#define IDC_CHECK_NPN_DESTROYSTREAM 1010 +#define IDC_CHECK_NPN_STATUS 1011 +#define IDC_CHECK_NPN_ESERAGENT 1012 +#define IDC_CHECK_NPN_MEMALLOC 1013 +#define IDC_CHECK_NPN_MEMFREE 1014 +#define IDC_CHECK_NPN_MEMFLUSH 1015 +#define IDC_CHECK_NPN_RELOADPLUGINS 1016 +#define IDC_CHECK_NPNGETJAVAENV 1017 +#define IDC_CHECK_NPN_GETJAVAENV 1017 +#define IDC_CHECK_NPN_GETJAVAPEER 1018 +#define IDC_CHECK_NPN_GETVALUE 1019 +#define IDC_CHECK_NPN_SETVALUE 1020 +#define IDC_CHECK_NPN_INVALIDATERECT 1021 +#define IDC_CHECK_NPN_INVALIDATEREGION 1021 +#define IDC_CHECK_NPNINVALIDATEREGION 1022 +#define IDC_CHECK_NPN_FORCEREDRAW 1023 +#define IDC_CHECK_NPP_NEW 1024 +#define IDC_CHECK_NPP_DESTROY 1025 +#define IDC_CHECK_NPP_SETWINDOW 1026 +#define IDC_CHECK_NPP_NEWSTREAM 1027 +#define IDC_CHECK_NPP_DESTROYSTREAM 1028 +#define IDC_CHECK_NPP_STREAMASFILE 1029 +#define IDC_CHECK_NPP_WRITEREADY 1030 +#define IDC_CHECK_NPP_WRITE 1031 +#define IDC_CHECK_NPP_PRINT 1032 +#define IDC_CHECK_NPP_HANDLEEVENT 1033 +#define IDC_CHECK_NPP_URLNOTIFY 1034 +#define IDC_CHECK_NPP_GETJAVACLASS 1035 +#define IDC_CHECK_NPP_GETVALUE 1036 +#define IDC_CHECK_NPP_SETVALUE 1037 +#define IDC_BUTTON_CHECKALL 1038 +#define IDC_BUTTON_CLEARALL 1039 +#define IDC_CHECK_TOCONSOLE 1041 +#define IDC_CHECK_TOWINDOW 1042 +#define IDC_CHECK_TOFILE 1043 +#define IDC_CHECK_SPALID 1044 +#define IDC_EDIT_FILE 1047 +#define IDC_BUTTON_CHOOSEDIR 1048 +#define IDC_CHECK_MUTE 2019 +#define IDC_CHECK_ONTOP 2020 +#define IDC_BUTTON_OPTIONS 2023 +#define IDC_BUTTON_CLEAR 2024 +#define IDC_OUTPUT 2026 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1049 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/modules/plugin/npspy/windows/setupexe.cpp b/mozilla/modules/plugin/npspy/windows/setupexe.cpp new file mode 100644 index 00000000000..49fcdaf708c --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/setupexe.cpp @@ -0,0 +1,8 @@ +#include +#include "setup.h" + +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + SPY_Setup(); + return 0; +} diff --git a/mozilla/modules/plugin/npspy/windows/spysetup.dsp b/mozilla/modules/plugin/npspy/windows/spysetup.dsp new file mode 100644 index 00000000000..4cc31cdd068 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/spysetup.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="spysetup" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=spysetup - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spysetup.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spysetup.mak" CFG="spysetup - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spysetup - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "spysetup - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spysetup - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "spysetup - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "spysetup___Win32_Debug" +# PROP BASE Intermediate_Dir "spysetup___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../include" /D "XP_WIN" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib debug/npspy.lib /nologo /subsystem:windows /debug /machine:I386 /out:"..\..\..\..\dist\WIN32_D.OBJ\bin\plugins\spysetup.exe" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "spysetup - Win32 Release" +# Name "spysetup - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\setupexe.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/mozilla/modules/plugin/npspy/windows/windowsxx.h b/mozilla/modules/plugin/npspy/windows/windowsxx.h new file mode 100644 index 00000000000..a9d90bd522d --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/windowsxx.h @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __WINDOWSXX_H__ +#define __WINDOWSXX_H__ + +/* void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) */ +#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \ + (fn)((hwnd), (int)(wParam), (LPNMHDR)lParam) + +#endif diff --git a/mozilla/modules/plugin/npspy/windows/winentry.cpp b/mozilla/modules/plugin/npspy/windows/winentry.cpp new file mode 100644 index 00000000000..7f2efd4e624 --- /dev/null +++ b/mozilla/modules/plugin/npspy/windows/winentry.cpp @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +// Windows entry point. Mainly for debug purposes. +#include + +char szAppName[] = "NPSpy"; +HINSTANCE hInst = NULL; + +BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) +{ +#ifdef DEBUG + char szReason[80]; + + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + strcpy(szReason, "DLL_PROCESS_ATTACH"); + break; + case DLL_THREAD_ATTACH: + strcpy(szReason, "DLL_THREAD_ATTACH"); + break; + case DLL_PROCESS_DETACH: + strcpy(szReason, "DLL_PROCESS_DETACH"); + break; + case DLL_THREAD_DETACH: + strcpy(szReason, "DLL_THREAD_DETACH"); + break; + } +#endif + + hInst = hDLL; + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/include/actionnames.h b/mozilla/modules/plugin/tools/spy/include/actionnames.h new file mode 100644 index 00000000000..374cd9d8e28 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/actionnames.h @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __ACTIONNAMES_H__ +#define __ACTIONNAMES_H__ + +// the order is important +char * ActionName[] = +{ + "INVALID_CALL", + "NPN_Version", + "NPN_GetURLNotify", + "NPN_GetURL", + "NPN_PostURLNotify", + "NPN_PostURL", + "NPN_RequestRead", + "NPN_NewStream", + "NPN_Write", + "NPN_DestroyStream", + "NPN_Status", + "NPN_UserAgent", + "NPN_MemAlloc", + "NPN_MemFree", + "NPN_MemFlush", + "NPN_ReloadPlugins", + "NPN_GetJavaEnv", + "NPN_GetJavaPeer", + "NPN_GetValue", + "NPN_SetValue", + "NPN_InvalidateRect", + "NPN_InvalidateRegion", + "NPN_ForceRedraw", + "NPP_New", + "NPP_Destroy", + "NPP_SetWindow", + "NPP_NewStream", + "NPP_DestroyStream", + "NPP_StreamAsFile", + "NPP_WriteReady", + "NPP_Write", + "NPP_Print", + "NPP_HandleEvent", + "NPP_URLNotify", + "NPP_GetJavaClass", + "NPP_GetValue", + "NPP_SetValue" +}; + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/dirpick.h b/mozilla/modules/plugin/tools/spy/include/dirpick.h new file mode 100644 index 00000000000..cd01fc58be6 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/dirpick.h @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __DIRPICK_H__ +#define __DIRPICK_H__ + +// pops up "Choose Directory" dialog box allowing to browse the directry +// structure. Returns TRUE on OK and FALSE on Cancel. Directory chosen +// returned in lpszString. Use lpszString to initialize the dialog box. If +// specified directory does not exist it will start with the current directory +BOOL PickupDirectory(HWND hWndOwner, LPSTR lpszString); + +#endif // __DIRPICK_H__ \ No newline at end of file diff --git a/mozilla/modules/plugin/tools/spy/include/epmanager.h b/mozilla/modules/plugin/tools/spy/include/epmanager.h new file mode 100644 index 00000000000..11aa38afbff --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/epmanager.h @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __EPMANAGER_H__ +#define __EPMANAGER_H__ + +#include "npapi.h" +#include "npupp.h" + +typedef NPError (__stdcall * NP_GETENTRYPOINTS) (NPPluginFuncs* pFuncs); +typedef NPError (__stdcall * NP_INITIALIZE) (NPNetscapeFuncs* pFuncs); +typedef NPError (__stdcall * NP_SHUTDOWN) (void); + +struct InstanceList +{ + InstanceList * next; + NPP instance; + + InstanceList(NPP _instance); + ~InstanceList(); +}; + +struct PluginEntryPointList +{ + PluginEntryPointList * next; + char mimetype[80]; + InstanceList * instances; + NPPluginFuncs realNPPFuncs; + NP_SHUTDOWN realShutdown; + XP_HLIB hLib; + + PluginEntryPointList(); + ~PluginEntryPointList(); +}; + +class NPPEntryPointManager +{ +private: + PluginEntryPointList * mEntryPoints; + +public: + void createEntryPointsForPlugin(char * mimetype, NPPluginFuncs * funcs, NP_SHUTDOWN shutdownproc, XP_HLIB hLib); + void removeEntryPointsForPlugin(NPP instance, XP_HLIB * lib); + NPPluginFuncs * findEntryPointsForPlugin(char * mimetype); + +private: + NPPluginFuncs * findEntryPointsForInstance(NPP instance); + +public: + NPPEntryPointManager(); + ~NPPEntryPointManager(); + + void callNP_Shutdown(NPP instance); + void callNP_ShutdownAll(); + + NPError callNPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); + NPError callNPP_Destroy(NPP instance, NPSavedData** save, BOOL * last); + NPError callNPP_SetWindow(NPP instance, NPWindow* window); + NPError callNPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); + NPError callNPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); + int32 callNPP_WriteReady(NPP instance, NPStream* stream); + int32 callNPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); + void callNPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); + void callNPP_Print(NPP instance, NPPrint* platformPrint); + void callNPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); + jref callNPP_GetJavaClass(void); + NPError callNPP_GetValue(NPP instance, NPPVariable variable, void *value); + NPError callNPP_SetValue(NPP instance, NPNVariable variable, void *value); + int16 callNPP_HandleEvent(NPP instance, void* event); +}; + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/format.h b/mozilla/modules/plugin/tools/spy/include/format.h new file mode 100644 index 00000000000..b2659e4ad23 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/format.h @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __FORMAT_H__ +#define __FORMAT_H__ + +#include "npapi.h" + +typedef enum +{ + action_invalid = 0, + action_npn_version, + action_npn_get_url_notify, + action_npn_get_url, + action_npn_post_url_notify, + action_npn_post_url, + action_npn_request_read, + action_npn_new_stream, + action_npn_write, + action_npn_destroy_stream, + action_npn_status, + action_npn_user_agent, + action_npn_mem_alloc, + action_npn_mem_free, + action_npn_mem_flush, + action_npn_reload_plugins, + action_npn_get_java_env, + action_npn_get_java_peer, + action_npn_get_value, + action_npn_set_value, + action_npn_invalidate_rect, + action_npn_invalidate_region, + action_npn_force_redraw, + + action_npp_new, + action_npp_destroy, + action_npp_set_window, + action_npp_new_stream, + action_npp_destroy_stream, + action_npp_stream_as_file, + action_npp_write_ready, + action_npp_write, + action_npp_print, + action_npp_handle_event, + action_npp_url_notify, + action_npp_get_java_class, + action_npp_get_value, + action_npp_set_value +} NPAPI_Action; + +struct LogArgumentStruct +{ + DWORD dwArg; + int iLength; + void * pData; + + LogArgumentStruct() + { + iLength = 0; + pData = NULL; + } + + ~LogArgumentStruct() + { + if(pData != NULL) + delete [] pData; + iLength = 0; + } +}; + +struct LogItemStruct +{ + NPAPI_Action action; + LogArgumentStruct arg1; + LogArgumentStruct arg2; + LogArgumentStruct arg3; + LogArgumentStruct arg4; + LogArgumentStruct arg5; + LogArgumentStruct arg6; + LogArgumentStruct arg7; + + LogItemStruct(){} + ~LogItemStruct(){} +}; + +char * FormatNPAPIError(int iError); +char * FormatNPAPIReason(int iReason); +char * FormatNPPVariable(NPPVariable var); +char * FormatNPNVariable(NPNVariable var); +BOOL FormatPCHARArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +BOOL FormatBOOLArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +BOOL FormatPBOOLArgument(char * szBuf, int iLength, LogArgumentStruct * parg); +LogItemStruct * makeLogItemStruct(NPAPI_Action action, + DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4, + DWORD dw5, DWORD dw6, DWORD dw7, BOOL bShort = FALSE); +void freeLogItemStruct(LogItemStruct * lis); +int formatLogItem(LogItemStruct * plis, char * szOutput, BOOL bDOSStyle = FALSE); + +#endif // __LOGHLP_H__ diff --git a/mozilla/modules/plugin/tools/spy/include/logfile.h b/mozilla/modules/plugin/tools/spy/include/logfile.h new file mode 100644 index 00000000000..46e438e78a3 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/logfile.h @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __LOGFILE_H__ +#define __LOGFILE_H__ + +class CLogFile +{ +private: + char szFileName[256]; + XP_HFILE hFile; + +public: + CLogFile(); + ~CLogFile(); + + BOOL create(char * filename, BOOL delete_existing = FALSE); + void close(); + DWORD write(char * buf); + void flush(); +}; + +#endif // __LOGFILE_H__ diff --git a/mozilla/modules/plugin/tools/spy/include/logger.h b/mozilla/modules/plugin/tools/spy/include/logger.h new file mode 100644 index 00000000000..e32bda2e44c --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/logger.h @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef _LOGGER_H__ +#define __LOGGER_H__ + +#include "npupp.h" +#include "format.h" +#include "logfile.h" + +#define TOTAL_NUMBER_OF_API_CALLS 37 +#define DEFAULT_LOG_FILE_NAME "spylog.txt" + +class Logger +{ +public: + BOOL bMutedAll; + BOOL bToWindow; + BOOL bToConsole; + BOOL bToFile; + BOOL bOnTop; + BOOL bSPALID; //ShutdownPluginAfterLastInstanceDestroyed + // as opposed to 'only when NS asks to' + CLogFile filer; + + BOOL bSaveSettings; + char szFile[_MAX_PATH]; + + // 37 is the total number of API calls + // (NPN_* and NPP_* only, NPP_Initialize and NPP_Shutdown not included) + BOOL bMutedCalls[TOTAL_NUMBER_OF_API_CALLS]; + +public: + Logger(); + ~Logger(); + + BOOL init(); + void shut(); + + // platform dependent virtuals + virtual BOOL platformInit() = 0; + virtual void platformShut() = 0; + virtual void dumpStringToMainWindow(char * string) = 0; + + void setOnTop(BOOL ontop); + void setToFile(BOOL tofile, char * filename); + + BOOL * getMutedCalls(); + void setMutedCalls(BOOL * mutedcalls); + + BOOL isMuted(NPAPI_Action action); + + void logNS_NP_GetEntryPoints(); + void logNS_NP_Initialize(); + void logNS_NP_Shutdown(); + + void logSPY_NP_GetEntryPoints(NPPluginFuncs * pNPPFuncs); + void logSPY_NP_Initialize(); + void logSPY_NP_Shutdown(char * mimetype); + + void logCall(NPAPI_Action action, DWORD dw1 = 0L, DWORD dw2 = 0L, + DWORD dw3 = 0L, DWORD dw4 = 0L, DWORD dw5 = 0L, DWORD dw6 = 0L, DWORD dw7 = 0L); + void logReturn(DWORD dwRet = 0L); +}; + +Logger * NewLogger(); +void DeleteLogger(Logger * logger); + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/plugload.h b/mozilla/modules/plugin/tools/spy/include/plugload.h new file mode 100644 index 00000000000..bc8a0aa7018 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/plugload.h @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PLUGLOAD_H__ +#define __PLUGLOAD_H__ + +DWORD GetPluginsDir(char * path, DWORD maxsize); +XP_HLIB LoadRealPlugin(char * mimetype); +void UnloadRealPlugin(XP_HLIB hLib); + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/profile.h b/mozilla/modules/plugin/tools/spy/include/profile.h new file mode 100644 index 00000000000..b567ba84503 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/profile.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PROFILE_H__ +#define __PROFILE_H__ + +class Profile +{ +public: + Profile(); + ~Profile(); + + virtual BOOL getBool(char * key, BOOL * value) = 0; + virtual BOOL setBool(char * key, BOOL value) = 0; + + virtual BOOL getString(char * key, char * string, int size) = 0; + virtual BOOL setString(char * key, char * string) = 0; +}; + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/setup.h b/mozilla/modules/plugin/tools/spy/include/setup.h new file mode 100644 index 00000000000..05b37456ba2 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/setup.h @@ -0,0 +1,6 @@ +#ifndef __SETUP_H__ +#define __SETUP_H__ + +void WINAPI SPY_Setup(); + +#endif diff --git a/mozilla/modules/plugin/tools/spy/include/xp.h b/mozilla/modules/plugin/tools/spy/include/xp.h new file mode 100644 index 00000000000..3fc867148de --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/include/xp.h @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __XP_H__ +#define __XP_H__ + +/*****************************************************/ + +#ifdef XP_WIN + + #include + +#endif + +/*****************************************************/ + + +#ifdef XP_MAC + #include +#endif + +#if (defined XP_MAC || defined XP_UNIX) + + typedef unsigned char BYTE; + + #define strcmpi strcmp + +#endif + + +/*****************************************************/ + +#ifdef XP_UNIX + #include + #include /* strcat() */ + #include /* stat() */ + #include + #include /* atoi() */ + #include /* assert() */ + #include /* isprint() */ + + #ifndef FALSE + #define FALSE false + #endif + + #ifndef TRUE + #define TRUE true + #endif + + #ifndef HIBYTE + #define HIBYTE(x) ((((u_int)(x)) & 0xff00)>>8) + #endif + + #ifndef LOBYTE + #define LOBYTE(x) (((u_int)(x)) & 0x00ff) + #endif + + #ifndef XP_EXPORT_API + #define XP_EXPORT_API + #endif + +#endif + +/*****************************************************/ + +#ifdef XP_WIN + + #define XP_HFILE HFILE + #define XP_HLIB HINSTANCE + + #define XP_EXPORT_API WINAPI + +#else + + #define XP_HFILE FILE* + + #ifndef DWORD + #define DWORD unsigned long + #endif + + #ifndef UINT + #define UINT unsigned int + #endif + + #ifndef WORD + #define WORD unsigned short + #endif + + #ifndef BOOL + #define BOOL bool + #endif + + #if (defined XP_UNIX) /* For IRIX */ + #ifndef bool + #define bool unsigned char + #endif + #endif + +#endif + + + +/*****************************************************/ + +#ifndef _MAX_PATH + #define _MAX_PATH 256 +#endif + +/*****************************************************/ + +// File utilities +BOOL XP_IsFile(char * szFileName); +XP_HFILE XP_CreateFile(char * szFileName); +XP_HFILE XP_OpenFile(char * szFileName); +void XP_CloseFile(XP_HFILE hFile); +void XP_DeleteFile(char * szFileName); +DWORD XP_WriteFile(XP_HFILE hFile, void * pBuf, int iSize); +void XP_FlushFileBuffers(XP_HFILE hFile); + +#endif diff --git a/mozilla/modules/plugin/tools/spy/windows/dirpick.cpp b/mozilla/modules/plugin/tools/spy/windows/dirpick.cpp new file mode 100644 index 00000000000..b9c0f7f11b9 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/dirpick.cpp @@ -0,0 +1,589 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include +#include +#include +#include + +#include "resource.h" + +extern HINSTANCE hInst; + +#define ITEM_BITMAPWIDTH 16 +#define ITEM_BITMAPHEIGHT 16 +#define ITEM_LEFTMARGIN 4 +#define ITEM_GAP 4 + +static HWND hWndDirPicker; +static HICON hIconDrives[5]; +static HICON hIconFolders[3]; +static LPSTR lpszStringToReturn; +static char szUNCRoot[256] = ""; + +UINT DriveType(UINT iType); + +static void fillComboBox(HWND hWnd) +{ + HWND hWndCB = GetDlgItem(hWnd, ID_COMBO_DIR); + HWND hWndTempLB = GetDlgItem(hWnd, ID_LISTTEMP_DIR); + if(hWndCB == NULL) + return; + ComboBox_ResetContent(hWndCB); + ListBox_ResetContent(hWndTempLB); + ListBox_Dir(hWndTempLB, DDL_DRIVES|DDL_EXCLUSIVE, (LPSTR)"*"); + + int iDriveCount = ListBox_GetCount(hWndTempLB); + int iCurDrive=_getdrive() - 1; + + char szDrive[16]; + char szItem[80]; + + for (int i = 0; i < iDriveCount; i++) + { + ListBox_GetText(hWndTempLB, i, szDrive); + CharLower(szDrive); + int iDrive = szDrive[2] - 'a'; + char szRoot[16]; + sprintf(szRoot, "%c:\\", szDrive[2]); + + int iType = DriveType(iDrive); + + if(iType < 2) + continue; + + //Start the item string with the drive letter, colon, and two spaces + sprintf(szItem, "%c%s", szDrive[2], ": "); + + if((iType == DRIVE_FIXED) || (iType == DRIVE_RAMDISK)) + { // get volume ID + char szVolumeID[80]; + DWORD dwMaxLength; + DWORD dwSysFlags; + GetVolumeInformation(szRoot, // address of root directory of the file system + szVolumeID, // address of name of the volume + sizeof(szVolumeID), // length of lpVolumeNameBuffer + NULL, // address of volume serial number + &dwMaxLength, // address of system's maximum filename length + &dwSysFlags, // address of file system flags + NULL, // address of name of file system + NULL); // length of lpFileSystemNameBuffer + + CharLower(szVolumeID); + lstrcat(szItem, szVolumeID); + } + + //For network drives, go grab the \\server\share for it. + if(DRIVE_REMOTE == iType) + { + char szNet[64]; + szNet[0] = '\0'; + DWORD dwSizeOfszNet = sizeof(szNet); + + sprintf(szDrive, "%c:", szDrive[2]); + CharUpper(szDrive); + WNetGetConnection(szDrive, szNet, &dwSizeOfszNet); + CharLower(szNet); + lstrcat(szItem, szNet); + } + + int index = ComboBox_AddString(hWndCB, szItem); + ComboBox_SetItemData(hWndCB, index, MAKELONG(iDrive, iType)); + if(iDrive == iCurDrive) + ComboBox_SetCurSel(hWndCB, index); + if(szUNCRoot[0] != '\0') + ComboBox_SetCurSel(hWndCB, -1); + } +} + +static void fillTempLBWithDirs(HWND hWndTempLB, LPSTR lpszDir) +{ + BOOL bDone = FALSE; + WIN32_FIND_DATA ffdataStruct; + + char szPath[_MAX_PATH]; + char szFileName[_MAX_PATH]; + lstrcpy(szPath, lpszDir); + if(szPath[lstrlen(szPath) - 1] == '\\') + szPath[lstrlen(szPath) - 1] = '\0'; + lstrcpy(szFileName, szPath); + lstrcat(szFileName, "\\*"); + HANDLE handle = FindFirstFile(szFileName, &ffdataStruct); + if(handle == INVALID_HANDLE_VALUE) + { + FindClose(handle); + return; + } + while(!bDone) + { + lstrcpy(szFileName, szPath); + lstrcat(szFileName, "\\"); + lstrcat(szFileName, ffdataStruct.cFileName); + if(ffdataStruct. dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + char szStringToAdd[_MAX_PATH + 2]; + lstrcpy(szStringToAdd, "["); + lstrcat(szStringToAdd, ffdataStruct.cFileName); + lstrcat(szStringToAdd, "]"); + CharLower(szStringToAdd); + ListBox_AddString(hWndTempLB, szStringToAdd); + } + bDone = !FindNextFile(handle, &ffdataStruct); + } + FindClose(handle); +} + +static void fillListBox(HWND hWnd, LPSTR lpszDir) +{ + HWND hWndLB = GetDlgItem(hWnd, ID_LIST_DIR); + HWND hWndTempLB = GetDlgItem(hWnd, ID_LISTTEMP_DIR); + HWND hWndEdit = GetDlgItem(hWnd, ID_EDIT_DIR); + if((hWndLB == NULL) || (lpszDir == NULL)) + return; + + int iLastChar = lstrlen(lpszDir); + if(lpszDir[iLastChar - 1] == '\\') + lpszDir[iLastChar - 1] = '\0'; + + SetWindowRedraw(hWndLB, FALSE); + ListBox_ResetContent(hWndLB); + ListBox_ResetContent(hWndTempLB); + + LPSTR lpszLast; + lpszLast = CharLower(lpszDir); + + SetWindowText(hWndLB, lpszDir); + + char szDir[_MAX_DIR]; + char szFullDir[_MAX_DIR]; + sprintf(szFullDir, "%s", lpszDir); + sprintf(szDir, "%s\\*.*", lpszDir); + + BOOL bFirst = TRUE; + char ch; + int index; + while (TRUE) + { + LPSTR lpsz; + if((lpszDir[0] == '\\') && (lpszDir[1] == '\\') && bFirst) + lpsz = strchr(lpszLast + lstrlen(szUNCRoot), '\\'); + else + lpsz = strchr(lpszLast, '\\'); + if(lpsz != NULL) { + if (bFirst) + ch = *(++lpsz); + else + ch = *lpsz; + *lpsz = 0; + } + else + { + //If we're looking at a drive only, then append a backslash + if (lpszLast == lpszDir && bFirst) + lstrcat(lpszLast, "\\"); + } + //Add the drive string--includes the last one where lpsz == NULL + index = ListBox_AddString(hWndLB, lpszLast); + + UINT i = (NULL != lpsz) ? ID_ICON_FOLDEROPEN : ID_ICON_OPENSELECT; + ListBox_SetItemData(hWndLB, index, MAKELONG(index, i)); + + if(NULL == lpsz) + break; + + //Restore last character. + *lpsz = ch; + lpsz += (bFirst) ? 0 : 1; + + bFirst=FALSE; + lpszLast = lpsz; + } + int indent = index + 1; + + //Get available directories + fillTempLBWithDirs(hWndTempLB, lpszDir); + + int itemCount = ListBox_GetCount(hWndTempLB); + + for (int i = 0; i < itemCount; i++) { + index = ListBox_GetText(hWndTempLB, i, lpszDir); + //Skip directories beginning with . (skipping . and ..) + if(lpszDir[1] == '.') + continue; + //Remove the ending ']' + iLastChar = lstrlen(lpszDir); + lpszDir[iLastChar - 1] = '\0'; + //Add the string to the real directory list. + index = ListBox_AddString(hWndLB, lpszDir + 1); + ListBox_SetItemData(hWndLB, index, MAKELONG(indent, ID_ICON_FOLDERCLOSED)); + } + //Force a listbox repaint. + SetWindowRedraw(hWndLB, TRUE); + InvalidateRect(hWndLB, NULL, TRUE); + + if(szFullDir[lstrlen(szFullDir) - 1] == ':') + lstrcat(szFullDir, "\\"); + Edit_SetText(hWndEdit, szFullDir); + + GetScrollRange(hWndLB, SB_VERT, (LPINT)&i, (LPINT)&index); + + if(!(i == 0 && index == 0)) + ListBox_SetTopIndex(hWndLB, max((int)(index - 2), 0)); + + ListBox_SetCurSel(hWndLB, indent - 1); +} + +static void onDrawItem(LPDRAWITEMSTRUCT lpdis, BOOL bDrive) +{ + if((int)lpdis->itemID < 0) + return; + + char szItem[_MAX_DIR]; + DWORD dwItemData; + + if(bDrive) + { + dwItemData = ComboBox_GetItemData(lpdis->hwndItem, lpdis->itemID); + ComboBox_GetLBText(lpdis->hwndItem, lpdis->itemID, szItem); + } + else + { + dwItemData = ListBox_GetItemData(lpdis->hwndItem, lpdis->itemID); + ListBox_GetText(lpdis->hwndItem, lpdis->itemID, szItem); + } + + if(lpdis->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) + { + COLORREF colorText; + COLORREF colorBack; + if(lpdis->itemState & ODS_SELECTED) + { + colorText = SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + colorBack = SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); + } + HICON hIcon; + int indent = 0; + if(bDrive) + { + int iType=(int)HIWORD(dwItemData); + switch (iType) + { + case DRIVE_REMOVABLE: + hIcon = hIconDrives[0]; + break; + case DRIVE_FIXED: + hIcon = hIconDrives[1]; + break; + case DRIVE_REMOTE: + hIcon = hIconDrives[2]; + break; + case DRIVE_CDROM: + hIcon = hIconDrives[3]; + break; + case DRIVE_RAMDISK: + hIcon = hIconDrives[4]; + break; + } + + } + else + { + int iconID = (int)HIWORD(lpdis->itemData); + switch (iconID) + { + case ID_ICON_FOLDERCLOSED: + hIcon = hIconFolders[0]; + break; + case ID_ICON_FOLDEROPEN: + hIcon = hIconFolders[1]; + break; + case ID_ICON_OPENSELECT: + hIcon = hIconFolders[2]; + break; + } + indent = 4 * (1 + LOWORD(lpdis->itemData)); + } + + ExtTextOut(lpdis->hDC, + lpdis->rcItem.left + ITEM_LEFTMARGIN + ITEM_BITMAPWIDTH + ITEM_GAP + indent, + lpdis->rcItem.top, + ETO_OPAQUE | ETO_CLIPPED, + &lpdis->rcItem, + szItem, + lstrlen(szItem), + NULL); + + BOOL res = DrawIcon(lpdis->hDC, + lpdis->rcItem.left + ITEM_LEFTMARGIN + indent, + lpdis->rcItem.top, + hIcon); + + if(lpdis->itemState & ODS_SELECTED) + { + SetTextColor(lpdis->hDC, colorText); + SetBkColor(lpdis->hDC, colorBack); + } + } + if((lpdis->itemAction & ODA_FOCUS) || (lpdis->itemState & ODS_FOCUS)) + DrawFocusRect(lpdis->hDC, &lpdis->rcItem); +} + +static void fillUNCRootArray(LPSTR lpsz) +{ + char szCurDir[_MAX_PATH]; + _getcwd(szCurDir, sizeof(szCurDir)); + lstrcpy(szUNCRoot, lpsz); + if(szUNCRoot[lstrlen(szUNCRoot) - 1] == '\\') + szUNCRoot[lstrlen(szUNCRoot) - 1] = '\0'; + for(;;) + { + LPSTR lptemp = strrchr(szUNCRoot, '\\'); + if(lptemp == NULL) + break; + *lptemp = '\0'; + if(_chdir(szUNCRoot) == -1) + { + *lptemp = '\\'; + break; + } + } + _chdir(szCurDir); +} + +static void onInitDialog(HWND hWnd, LPSTR lpsz) +{ + hWndDirPicker = hWnd; + lpszStringToReturn = lpsz; + + hIconDrives[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEFLOPPY)); + hIconDrives[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVEHARD)); + hIconDrives[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVENETWORK)); + hIconDrives[3] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVECDROM)); + hIconDrives[4] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_DRIVERAM)); + + hIconFolders[0] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDERCLOSED)); + hIconFolders[1] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_FOLDEROPEN)); + hIconFolders[2] = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_OPENSELECT)); + + if(lpsz[0] == '\0') + _getcwd(lpsz, _MAX_PATH); + else if(lpsz[lstrlen(lpsz) - 1] == ':') + lstrcat(lpsz, "\\"); + + int ret = _chdir(lpsz); + if(ret == -1) + { + char szText[_MAX_PATH + 80]; + sprintf(szText, "The specified directory %s\ncannot be found", lpsz); + MessageBox(GetParent(hWnd), szText, "Choose Directory", MB_ICONEXCLAMATION|MB_OK); + _getcwd(lpsz, _MAX_PATH); + } + if((lpsz[0] == '\\') && (lpsz[1] == '\\')) + fillUNCRootArray(lpsz); + fillListBox(hWnd, lpsz); + fillComboBox(hWnd); +} + +static void shutDialog(HWND hWnd) +{ + szUNCRoot[0] = '\0'; +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + char szCurDir[_MAX_PATH]; + switch(id) + { + case ID_LIST_DIR: + if(codeNotify == LBN_DBLCLK) + { + int index = ListBox_GetCurSel(hWndCtl); + DWORD dwItemData = ListBox_GetItemData(hWndCtl, index); + + if(HIWORD(dwItemData) == ID_ICON_OPENSELECT) + { + shutDialog(hWnd); + char szString[_MAX_PATH]; + Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString)); + lstrcpy(lpszStringToReturn, szString); + EndDialog(hWnd, IDOK); + break; + } + + ListBox_GetText(hWndCtl, index, szCurDir); + + char szDir[_MAX_DIR]; + LPSTR lpsz; + if((HIWORD(dwItemData) == ID_ICON_FOLDEROPEN) && (index != 0)) + { + GetWindowText(hWndCtl, szDir, sizeof(szDir)); + lpsz=_fstrstr(szDir, szCurDir); + *(lpsz + lstrlen(szCurDir)) = '\0'; + lstrcpy(szCurDir, szDir); + } + if (_chdir(szCurDir) == 0) + { + _getcwd(szCurDir, _MAX_PATH); + fillListBox(hWndDirPicker, szCurDir); + } + } + break; + case ID_COMBO_DIR: + if(codeNotify == CBN_SELCHANGE) + { + char szDrive[80]; + int index = ComboBox_GetCurSel(hWndCtl); + if(index == CB_ERR) + break; + ComboBox_GetLBText(hWndCtl, index, szDrive); + + int iCurDrive = _getdrive(); +Retry: + HCURSOR hCursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCapture(hWndDirPicker); + if((0 == _chdrive((int)(szDrive[0] - 'a' + 1))) && (NULL != _getcwd(szCurDir, _MAX_PATH))) + { + fillListBox(hWndDirPicker, szCurDir); + ListBox_SetTopIndex(GetDlgItem(hWndDirPicker, ID_LIST_DIR), 0); + SetCursor(hCursorOld); + ReleaseCapture(); + break; + } + SetCursor(hCursorOld); + ReleaseCapture(); + + char szText[80]; + sprintf(szText, "Cannot read drive %c:", szDrive[0]); + if(IDRETRY == MessageBox(hWndDirPicker, szText, "Choose Directory", MB_ICONEXCLAMATION|MB_RETRYCANCEL)) + goto Retry; + + //Changing drives failed so restore drive and selection + _chdrive(iCurDrive); + + sprintf(szDrive, "%c:", (char)(iCurDrive + 'a' - 1)); + index = ComboBox_SelectString(hWndCtl, -1, szDrive); + } + break; + case IDOK: + shutDialog(hWnd); + char szString[_MAX_PATH]; + Edit_GetText(GetDlgItem(hWndDirPicker, ID_EDIT_DIR), szString, sizeof(szString)); + lstrcpy(lpszStringToReturn, szString); + EndDialog(hWnd, IDOK); + break; + case IDCANCEL: + shutDialog(hWnd); + lpszStringToReturn[0] = '\0'; + EndDialog(hWnd, IDCANCEL); + break; + default: + break; + } +} + +static BOOL CALLBACK DirPickDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) { + case WM_INITDIALOG: + onInitDialog(hWnd, (LPSTR)lParam); + break; + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_MEASUREITEM: + { + static int cyItem = -1; //Height of a listbox item + LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam; + if(cyItem == -1) + { + HFONT hFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0L); + if(hFont == NULL) + hFont = GetStockFont(SYSTEM_FONT); + HDC hDC = GetDC(hWnd); + HFONT hFontOld = SelectFont(hDC, hFont); + TEXTMETRIC tm; + GetTextMetrics(hDC, &tm); + cyItem = max(ITEM_BITMAPHEIGHT, tm.tmHeight); + SelectFont(hDC, hFontOld); + ReleaseDC(hWnd, hDC); + } + + lpmis->itemHeight = cyItem; + } + break; + case WM_DRAWITEM: + onDrawItem((LPDRAWITEMSTRUCT)lParam, ((UINT)wParam == ID_COMBO_DIR)); + return TRUE; // to prevent default action in listbox (drawing focus) + default: + return FALSE; + } + return TRUE; +} + +/* + * DriveType + * + * Purpose: + * Augments the Windows API GetDriveType with a call to the CD-ROM + * extensions to determine if a drive is a floppy, hard disk, CD-ROM, + * RAM-drive, or networked drive. + * + * Parameters: + * iDrive UINT containing the zero-based drive index + * + * Return Value: + * UINT One of the following values describing the drive: + * DRIVE_FLOPPY, DRIVE_HARD, DRIVE_CDROM, DRIVE_RAMDISK, + * DRIVE_NETWORK. + * + * Copyright (c)1992 Kraig Brockschmidt, All Right Reserved + * Compuserve: 70750,2344 + * Internet : kraigb@microsoft.com + * + */ +UINT DriveType(UINT iDrive) +{ + //Validate possible drive indices + if((0 > iDrive) || (25 < iDrive)) + return (UINT)-1; + + static char path[] = "d:\\"; + path[0] = 'a' + iDrive; + int iType = GetDriveType(path); + + /* + * Under Windows NT, GetDriveType returns complete information + * not provided under Windows 3.x which we now get through other + * means. + */ + + return iType; +} + +BOOL PickupDirectory(HWND hWndOwner, LPSTR lpszString) +{ + if(hWndOwner == NULL) + hWndOwner = GetDesktopWindow(); + int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(ID_DIALOG_CHOOSEDIR), hWndOwner, DirPickDlgProc, (LPARAM)lpszString); + return (ret == IDOK); +} diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_advanced.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_advanced.cpp new file mode 100644 index 00000000000..da69be7d572 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_advanced.cpp @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bSPALID = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_SPALID)); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_SPALID, logger->bSPALID ? BST_CHECKED : BST_UNCHECKED); + } + + return TRUE; +} + +BOOL CALLBACK AdvancedPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_fiter.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_fiter.cpp new file mode 100644 index 00000000000..86b1759e313 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_fiter.cpp @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDC_BUTTON_CHECKALL: + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_CHECKED); + break; + } + case IDC_BUTTON_CLEARALL: + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_UNCHECKED); + break; + } + default: + break; + } +} + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + BOOL mutedcalls[TOTAL_NUMBER_OF_API_CALLS]; + + mutedcalls[0] = FALSE; // for invalid call + + // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + mutedcalls[i - IDC_CHECK_NPN_VERSION + 1] = (BST_UNCHECKED == IsDlgButtonChecked(hWnd, i)); + + logger->setMutedCalls(&mutedcalls[0]); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + BOOL * mutedcalls = logger->getMutedCalls(); + + if(mutedcalls) + { + // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, mutedcalls[i - IDC_CHECK_NPN_VERSION + 1] ? BST_UNCHECKED : BST_CHECKED); + } + else + { + for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++) + CheckDlgButton(hWnd, i, BST_CHECKED); + } + + return TRUE; +} + +BOOL CALLBACK FilterPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_general.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_general.cpp new file mode 100644 index 00000000000..9073cd866ea --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_general.cpp @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bOnTop = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_ONTOP)); + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_ONTOP, logger->bOnTop ? BST_CHECKED : BST_UNCHECKED); + } + + return TRUE; +} + +BOOL CALLBACK GeneralPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_log.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_log.cpp new file mode 100644 index 00000000000..f2cbcf29f9f --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_log.cpp @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "windowsxx.h" + +#include "resource.h" +#include "logger.h" +#include "dirpick.h" + +static void onChooseDir(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + char string[_MAX_PATH]; + char name[_MAX_PATH]; + + GetDlgItemText(hWnd, IDC_EDIT_FILE, string, strlen(string)); + char * p = NULL; + p = strrchr(string, '\\'); + if(p) + { + strcpy(name, p); + *p = '\0'; + } + + if(PickupDirectory(hWnd, string)) + { + //check the last character for being '\' + if(string[strlen(string) - 1] == '\\') + string[strlen(string) - 1] = '\0'; + + if(p) + strcat(string, name); + else + { + strcat(string, "\\"); + strcat(string, DEFAULT_LOG_FILE_NAME); + } + SetDlgItemText(hWnd, IDC_EDIT_FILE, string); + } +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDC_CHECK_TOFILE: + EnableWindow(GetDlgItem(hWnd, IDC_EDIT_FILE), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + EnableWindow(GetDlgItem(hWnd, IDC_BUTTON_CHOOSEDIR), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + break; + case IDC_BUTTON_CHOOSEDIR: + onChooseDir(hWnd); + break; + default: + break; + } +} + +static void onApply(HWND hWnd) +{ + Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER); + if(!logger) + return; + + logger->bToWindow = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOWINDOW)); + logger->bToConsole = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOCONSOLE)); + + char filename[_MAX_PATH]; + GetDlgItemText(hWnd, IDC_EDIT_FILE, filename, strlen(filename)); + logger->setToFile(BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE), filename); + + logger->bSaveSettings = TRUE; +} + +static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) +{ + switch(lpNMHdr->code) + { + case PSN_RESET: + break; + case PSN_APPLY: + onApply(hWnd); + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + Logger * logger = NULL; + + if(lParam) + { + logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam); + SetWindowLong(hWnd, DWL_USER, (long)logger); + } + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_TOWINDOW, logger->bToWindow ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_CHECK_TOCONSOLE, logger->bToConsole ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hWnd, IDC_CHECK_TOFILE, logger->bToFile ? BST_CHECKED : BST_UNCHECKED); + + SetDlgItemText(hWnd, IDC_EDIT_FILE, logger->szFile); + EnableWindow(GetDlgItem(hWnd, IDC_EDIT_FILE), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + EnableWindow(GetDlgItem(hWnd, IDC_BUTTON_CHOOSEDIR), (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOFILE))); + } + + return TRUE; +} + +BOOL CALLBACK LogPageProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_NOTIFY: + HANDLE_WM_NOTIFY(hWnd, wParam, lParam, onNotify); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_main.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_main.cpp new file mode 100644 index 00000000000..81e60ae51f9 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_main.cpp @@ -0,0 +1,291 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "resource.h" +#include "loggerw.h" +#include "profilew.h" + +extern HINSTANCE hInst; +extern char * ActionName[]; +extern char szAppName[]; + +BOOL CALLBACK GeneralPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK LogPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK FilterPageProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK AdvancedPageProc(HWND, UINT, WPARAM, LPARAM); + +static void onOptions(HWND hWnd, Logger * logger) +{ + if(!logger) + return; + + PROPSHEETPAGE psp[4]; + + psp[0].dwSize = sizeof(psp[0]); + psp[0].dwFlags = PSP_DEFAULT; + psp[0].hInstance = hInst; + psp[0].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_GENERAL); + psp[0].pszIcon = 0; + psp[0].pfnDlgProc = GeneralPageProc; + psp[0].pszTitle = 0; + psp[0].lParam = (LPARAM)logger; + psp[0].pfnCallback = NULL; + + psp[1].dwSize = sizeof(psp[1]); + psp[1].dwFlags = PSP_DEFAULT; + psp[1].hInstance = hInst; + psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_LOG); + psp[1].pszIcon = 0; + psp[1].pfnDlgProc = LogPageProc; + psp[1].pszTitle = 0; + psp[1].lParam = (LPARAM)logger; + psp[1].pfnCallback = NULL; + + psp[2].dwSize = sizeof(psp[2]); + psp[2].dwFlags = PSP_DEFAULT; + psp[2].hInstance = hInst; + psp[2].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_FILTER); + psp[2].pszIcon = 0; + psp[2].pfnDlgProc = FilterPageProc; + psp[2].pszTitle = 0; + psp[2].lParam = (LPARAM)logger; + psp[2].pfnCallback = NULL; + + psp[3].dwSize = sizeof(psp[3]); + psp[3].dwFlags = PSP_DEFAULT; + psp[3].hInstance = hInst; + psp[3].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_ADVANCED); + psp[3].pszIcon = 0; + psp[3].pfnDlgProc = AdvancedPageProc; + psp[3].pszTitle = 0; + psp[3].lParam = (LPARAM)logger; + psp[3].pfnCallback = NULL; + + PROPSHEETHEADER psh; + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; + psh.hwndParent = hWnd; + psh.hInstance = hInst; + psh.pszIcon = 0; + psh.pszCaption = "Settings"; + psh.nPages = sizeof(psp) / sizeof(psp[0]); + psh.nStartPage = 0; + psh.ppsp = psp; + psh.pfnCallback = NULL; + + logger->bSaveSettings = FALSE; + + int rv = PropertySheet(&psh); + if(rv == -1) + return; + + if(logger->bSaveSettings) + { + ProfileWin profile; + + if(hWnd != NULL) + { + RECT rc; + if(GetWindowRect(hWnd, &rc)) + profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); + } + + profile.setBool(NPSPY_REG_KEY_ONTOP, logger->bOnTop); + profile.setBool(NPSPY_REG_KEY_LOGTOWINDOW, logger->bToWindow); + profile.setBool(NPSPY_REG_KEY_LOGTOCONSOLE, logger->bToConsole); + profile.setBool(NPSPY_REG_KEY_LOGTOFILE, logger->bToFile); + profile.setBool(NPSPY_REG_KEY_SPALID, logger->bSPALID); + profile.setString(NPSPY_REG_KEY_LOGFILENAME, logger->szFile); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + profile.setBool(ActionName[i], !logger->bMutedCalls[i]); + + SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + } + + logger->bSaveSettings = FALSE; +} + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER); + switch (id) + { + case IDC_CHECK_MUTE: + if(logger) + logger->bMutedAll = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_MUTE)); + break; + case IDC_BUTTON_OPTIONS: + onOptions(hWnd, logger); + break; + case IDC_BUTTON_CLEAR: + if(logger) + logger->onClear(); + break; + default: + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + LoggerWin * logger = (LoggerWin *)lParam; + SetWindowLong(hWnd, DWL_USER, (long)logger); + SetWindowText(hWnd, szAppName); + HFONT hFont = GetStockFont(ANSI_FIXED_FONT); + SetWindowFont(GetDlgItem(hWnd, IDC_MAIN_OUTPUT), hFont, FALSE); + + if(logger) + { + CheckDlgButton(hWnd, IDC_CHECK_MUTE, logger->bMutedAll ? BST_CHECKED : BST_UNCHECKED); + if(logger->width && logger->height) + SetWindowPos(hWnd, NULL, logger->x, logger->y, logger->width, logger->height, SWP_NOZORDER); + + SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); + } + return TRUE; +} + +static void onDestroy(HWND hWnd) +{ + LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER); + if(logger) + logger->onDestroyWindow(); +} + +static void onSize(HWND hWnd, UINT state, int cx, int cy) +{ + long bu = GetDialogBaseUnits(); + int bux = LOWORD(bu); + int buy = HIWORD(bu); + int factorx = bux/4; + int factory = buy/8; + + int marginLeft = 7 * factorx; + int marginRight = 0 * factorx; + int marginTop = 0 * factory; + int marginBottom = 7 * factory; + int spaceHor = 4 * factorx; + int spaceVer = 7 * factory; + + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + HWND hWndCheckMute = GetDlgItem(hWnd, IDC_CHECK_MUTE); + HWND hWndCheckOntop = GetDlgItem(hWnd, IDC_CHECK_ONTOP); + HWND hWndButtonOptions = GetDlgItem(hWnd, IDC_BUTTON_OPTIONS); + HWND hWndClear = GetDlgItem(hWnd, IDC_BUTTON_CLEAR); + + RECT rcMain; + GetClientRect(hWnd, &rcMain); + + int width = rcMain.right - rcMain.left; + int height = rcMain.bottom - rcMain.top; + + RECT rcButtonOptions; + GetWindowRect(hWndButtonOptions, &rcButtonOptions); + SetWindowPos(hWndButtonOptions, NULL, + width - marginLeft - rcButtonOptions.right + rcButtonOptions.left, + height - rcButtonOptions.bottom + rcButtonOptions.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcClear; + GetWindowRect(hWndClear, &rcClear); + SetWindowPos(hWndClear, NULL, + width - marginLeft - rcClear.right + rcClear.left - rcButtonOptions.right + rcButtonOptions.left - spaceHor, + height - rcClear.bottom + rcClear.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcCheckMute; + GetWindowRect(hWndCheckMute, &rcCheckMute); + SetWindowPos(hWndCheckMute, NULL, + marginLeft, + height - rcCheckMute.bottom + rcCheckMute.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + RECT rcCheckOntop; + GetWindowRect(hWndCheckOntop, &rcCheckOntop); + SetWindowPos(hWndCheckOntop, NULL, + marginLeft + rcCheckMute.right - rcCheckMute.left + spaceHor, + height - rcCheckOntop.bottom + rcCheckOntop.top - marginBottom, + 0, 0, SWP_NOZORDER | SWP_NOSIZE); + + SetWindowPos(hWndOutput, NULL, + 0, 0, + width, + height - rcButtonOptions.bottom + rcButtonOptions.top - marginBottom - marginTop - spaceVer, + SWP_NOZORDER | SWP_NOMOVE); + + // somehow the Clear button doesn't redraw itself well, so force it + InvalidateRect(hWndClear, NULL, TRUE); + UpdateWindow(hWndClear); +} + +BOOL CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_CLOSE: + DestroyWindow(hWnd); + break; + case WM_DESTROY: + HANDLE_WM_DESTROY(hWnd, wParam, lParam, onDestroy); + break; + case WM_SIZE: + HANDLE_WM_SIZE(hWnd, wParam, lParam, onSize); + break; + + default: + return FALSE; + } + return TRUE; +} + +// This is exported function which allows to access Settings GUI from other applications +void WINAPI SPY_Setup() +{ + LoggerWin logger; + ProfileWin profile; + + profile.getBool(NPSPY_REG_KEY_ONTOP, &logger.bOnTop); + profile.getBool(NPSPY_REG_KEY_LOGTOWINDOW, &logger.bToWindow); + profile.getBool(NPSPY_REG_KEY_LOGTOCONSOLE, &logger.bToConsole); + profile.getBool(NPSPY_REG_KEY_LOGTOFILE, &logger.bToFile); + profile.getBool(NPSPY_REG_KEY_SPALID, &logger.bSPALID); + profile.getString(NPSPY_REG_KEY_LOGFILENAME, logger.szFile, strlen(logger.szFile)); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + { + BOOL selected = TRUE; + if(profile.getBool(ActionName[i], &selected)) + logger.bMutedCalls[i] = !selected; + } + + onOptions(NULL, &logger); +} \ No newline at end of file diff --git a/mozilla/modules/plugin/tools/spy/windows/gui_pause.cpp b/mozilla/modules/plugin/tools/spy/windows/gui_pause.cpp new file mode 100644 index 00000000000..f4f899a4dd2 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/gui_pause.cpp @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include + +#include "resource.h" + +static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify) +{ + switch (id) + { + case IDOK: + EndDialog(hWnd, IDOK); + break; + case IDCANCEL: + EndDialog(hWnd, IDCANCEL); + break; + default: + break; + } +} + +static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) +{ + SetWindowPos(hWnd, NULL, 0,0,0,0, SWP_NOZORDER); + return TRUE; +} + +BOOL CALLBACK PauseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog); + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand); + break; + case WM_CLOSE: + EndDialog(hWnd, IDCANCEL); + break; + + default: + return FALSE; + } + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/loggerw.cpp b/mozilla/modules/plugin/tools/spy/windows/loggerw.cpp new file mode 100644 index 00000000000..64e961169d4 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/loggerw.cpp @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include "xp.h" +#include "windowsx.h" + +#include "resource.h" +#include "loggerw.h" +#include "profilew.h" +#include "actionnames.h" + +extern HINSTANCE hInst; +static char szClassName[] = "NPSpyWindowClass"; + +BOOL CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK PauseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + +LoggerWin::LoggerWin() : Logger(), + hWnd(NULL), + width(0), + height(0), + x(0), + y(0), + bSaveSettings(FALSE) +{ +} + +LoggerWin::~LoggerWin() +{ +} + +BOOL LoggerWin::platformInit() +{ + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInst; + wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; + + // restore prefs + ProfileWin profile; + + profile.getBool(NPSPY_REG_KEY_ONTOP, &bOnTop); + profile.getBool(NPSPY_REG_KEY_LOGTOWINDOW, &bToWindow); + profile.getBool(NPSPY_REG_KEY_LOGTOCONSOLE, &bToConsole); + profile.getBool(NPSPY_REG_KEY_LOGTOFILE, &bToFile); + profile.getBool(NPSPY_REG_KEY_SPALID, &bSPALID); + profile.getString(NPSPY_REG_KEY_LOGFILENAME, szFile, strlen(szFile)); + + for(int i = 1; i < TOTAL_NUMBER_OF_API_CALLS; i++) + { + BOOL selected = TRUE; + if(profile.getBool(ActionName[i], &selected)) + bMutedCalls[i] = !selected; + } + + if(!profile.getSizeAndPosition(&width, &height, &x, &y)) + { + width = 0; + height = 0; + x = 0; + y = 0; + } + + hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG_MAIN), GetDesktopWindow(), (DLGPROC)MainDlgProc, (LPARAM)this); + if(hWnd == NULL) + { + UnregisterClass(szClassName, hInst); + return FALSE; + } + + if(bOnTop) + SetWindowPos(hWnd, bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); + + return TRUE; +} + +void LoggerWin::platformShut() +{ + if(hWnd != NULL) + { + char szLog[] = "--- GOING AWAY... PRESS SPACE BAR TO CONTINUE ---"; + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_AddString(hWndOutput, ""); + ListBox_AddString(hWndOutput, szLog); + int count = ListBox_GetCount(hWndOutput); + ListBox_SetCaretIndex(hWndOutput, count - 1); + UpdateWindow(hWndOutput); + + DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_PAUSE), hWnd, (DLGPROC)PauseDlgProc); + + ProfileWin profile; + + RECT rc; + if(GetWindowRect(hWnd, &rc)) + profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top); + + DestroyWindow(hWnd); + hWnd = NULL; + } + + UnregisterClass(szClassName, hInst); +} + +void LoggerWin::onDestroyWindow() +{ + hWnd = NULL; +} + +void LoggerWin::dumpStringToMainWindow(char * string) +{ + // listboxes don't want and so cut them off if any. The order is important. + char * p = strrchr(string, '\n'); + if(p) + *p = '\0'; + + p = strrchr(string, '\r'); + if(p) + *p = '\0'; + + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_AddString(hWndOutput, string); + int count = ListBox_GetCount(hWndOutput); + if(count == 32767) + ListBox_ResetContent(hWndOutput); + ListBox_SetCaretIndex(hWndOutput, count - 1); + UpdateWindow(hWndOutput); +} + +void LoggerWin::onClear() +{ + HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT); + ListBox_ResetContent(hWndOutput); + UpdateWindow(hWndOutput); +} + +Logger * NewLogger() +{ + LoggerWin * res = new LoggerWin(); + return res; +} + +void DeleteLogger(Logger * logger) +{ + if(logger) + delete logger; +} \ No newline at end of file diff --git a/mozilla/modules/plugin/tools/spy/windows/loggerw.h b/mozilla/modules/plugin/tools/spy/windows/loggerw.h new file mode 100644 index 00000000000..801ca3cdda9 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/loggerw.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __LOGGRERW_H__ +#define __LOGGRERW_H__ + +#include "logger.h" + +class LoggerWin : public Logger +{ +public: + HWND hWnd; + int width; + int height; + int x; + int y; + BOOL bSaveSettings; + + LoggerWin(); + ~LoggerWin(); + + BOOL platformInit(); + void platformShut(); + void dumpStringToMainWindow(char * string); + + void onDestroyWindow(); + void onClear(); +}; + +#endif diff --git a/mozilla/modules/plugin/tools/spy/windows/npspy.def b/mozilla/modules/plugin/tools/spy/windows/npspy.def new file mode 100644 index 00000000000..910e72038cb --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/npspy.def @@ -0,0 +1,29 @@ +; -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +; +; The contents of this file are subject to the Netscape Public +; License Version 1.1 (the "License"); you may not use this file +; except in compliance with the License. You may obtain a copy of +; the License at http://www.mozilla.org/NPL/ +; +; Software distributed under the License is distributed on an "AS +; IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +; implied. See the License for the specific language governing +; rights and limitations under the License. +; +; The Original Code is mozilla.org code. +; +; The Initial Developer of the Original Code is Netscape +; Communications Corporation. Portions created by Netscape are +; Copyright (C) 1998 Netscape Communications Corporation. All +; Rights Reserved. +; +; Contributor(s): +; + +LIBRARY NPSPY + +EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 + SPY_Setup @4 \ No newline at end of file diff --git a/mozilla/modules/plugin/tools/spy/windows/npspy.dsp b/mozilla/modules/plugin/tools/spy/windows/npspy.dsp new file mode 100644 index 00000000000..9b8c3b6d462 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/npspy.dsp @@ -0,0 +1,278 @@ +# Microsoft Developer Studio Project File - Name="npspy" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=npspy - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "npspy.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "npspy.mak" CFG="npspy - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "npspy - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "npspy - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "npspy - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 + +!ELSEIF "$(CFG)" == "npspy - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\..\..\dist\include" /I "..\..\..\..\dist\win32_d.obj\include" /D "XP_WIN" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NPSPY_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib version.lib advapi32.lib comctl32.lib mpr.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\..\dist\WIN32_D.OBJ\bin\plugins\npspy.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "npspy - Win32 Release" +# Name "npspy - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\dirpick.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\epmanager.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\fileutils.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\format.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_advanced.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_fiter.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_general.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_log.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_main.cpp +# End Source File +# Begin Source File + +SOURCE=.\gui_pause.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\logfile.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\logger.cpp +# End Source File +# Begin Source File + +SOURCE=.\loggerw.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\np_entry.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\npn_gate.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\npp_gate.cpp +# End Source File +# Begin Source File + +SOURCE=.\npspy.def +# End Source File +# Begin Source File + +SOURCE=.\npspy.rc +# End Source File +# Begin Source File + +SOURCE=..\common\plugload.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\profile.cpp +# End Source File +# Begin Source File + +SOURCE=.\profilew.cpp +# End Source File +# Begin Source File + +SOURCE=.\winentry.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\include\actionnames.h +# End Source File +# Begin Source File + +SOURCE=..\include\dirpick.h +# End Source File +# Begin Source File + +SOURCE=..\include\epmanager.h +# End Source File +# Begin Source File + +SOURCE=..\include\format.h +# End Source File +# Begin Source File + +SOURCE=..\include\logfile.h +# End Source File +# Begin Source File + +SOURCE=..\include\logger.h +# End Source File +# Begin Source File + +SOURCE=.\loggerw.h +# End Source File +# Begin Source File + +SOURCE=..\include\plugload.h +# End Source File +# Begin Source File + +SOURCE=..\include\profile.h +# End Source File +# Begin Source File + +SOURCE=.\profilew.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\windowsxx.h +# End Source File +# Begin Source File + +SOURCE=..\include\xp.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\cdrom.ico +# End Source File +# Begin Source File + +SOURCE=.\res\floppy.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldcl.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldop.ico +# End Source File +# Begin Source File + +SOURCE=.\res\foldopse.ico +# End Source File +# Begin Source File + +SOURCE=.\res\harddr.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon.ico +# End Source File +# Begin Source File + +SOURCE=.\res\netdr.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ramdr.ico +# End Source File +# End Group +# End Target +# End Project diff --git a/mozilla/modules/plugin/tools/spy/windows/npspy.dsw b/mozilla/modules/plugin/tools/spy/windows/npspy.dsw new file mode 100644 index 00000000000..8cc44e2378d --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/npspy.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "npspy"=.\npspy.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "spysetup"=.\spysetup.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/mozilla/modules/plugin/tools/spy/windows/npspy.rc b/mozilla/modules/plugin/tools/spy/windows/npspy.rc new file mode 100644 index 00000000000..e43992eccc0 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/npspy.rc @@ -0,0 +1,351 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "mozilla.org\0" + VALUE "FileDescription", "Spy plugin\0" + VALUE "FileExtents", "*\0" + VALUE "FileOpenName", "any name (*.*)\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SPYPLUGIN\0" + VALUE "LegalCopyright", "Copyright © 2001-\0" + VALUE "LegalTrademarks", "\0" + VALUE "MIMEType", "*\0" + VALUE "OriginalFilename", "NPSPY.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Mozilla Spy Plug-in\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // !_MAC + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG_MAIN DIALOG DISCARDABLE 0, 0, 322, 212 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU | WS_THICKFRAME +CAPTION "Dialog" +CLASS "NPSpyWindowClass" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_MAIN_OUTPUT,0,0,321,185,LBS_MULTIPLESEL | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP + CONTROL "&Mute",IDC_CHECK_MUTE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,195,32,10 + PUSHBUTTON "&Clear",IDC_BUTTON_CLEAR,209,191,50,14 + PUSHBUTTON "&Settings...",IDC_BUTTON_OPTIONS,263,191,50,14 +END + +IDD_DIALOG_PAUSE DIALOG DISCARDABLE 0, 0, 64, 29 +STYLE WS_POPUP +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,7,7,50,14 +END + +IDD_PAGE_GENERAL DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "General" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Always on &top",IDC_CHECK_ONTOP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,23,60,10 + GROUPBOX "Window",IDC_STATIC,7,7,224,32 +END + +IDD_PAGE_FILTER DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Filter" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Select calls to log",IDC_STATIC,7,7,224,232 + CONTROL "NPN_Version",IDC_CHECK_NPN_VERSION,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,22,59,10 + CONTROL "NPN_GetURLNotify",IDC_CHECK_NPN_GETURLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,32,79,10 + CONTROL "NPN_GetURL",IDC_CHECK_NPN_GETURL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,41,61,10 + CONTROL "NPN_PostURLNotify",IDC_CHECK_NPN_POSTURLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,51,82,10 + CONTROL "NPN_PostURL",IDC_CHECK_NPN_POSTURL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,61,64,10 + CONTROL "NPN_RequestRead",IDC_CHECK_NPN_REQUESTREAD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,70,79,10 + CONTROL "NPN_NewStream",IDC_CHECK_NPN_NEWSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,80,72,10 + CONTROL "NPN_Write",IDC_CHECK_NPN_WRITE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,89,52,10 + CONTROL "NPN_DestroyStream",IDC_CHECK_NPN_DESTROYSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,99,81,10 + CONTROL "NPN_Status",IDC_CHECK_NPN_STATUS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,109,55,10 + CONTROL "NPN_UserAgent",IDC_CHECK_NPN_ESERAGENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,118,69,10 + CONTROL "NPN_MemAlloc",IDC_CHECK_NPN_MEMALLOC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,128,66,10 + CONTROL "NPN_MemFree",IDC_CHECK_NPN_MEMFREE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,137,65,10 + CONTROL "NPN_MemFlush",IDC_CHECK_NPN_MEMFLUSH,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,147,67,10 + CONTROL "NPN_ReloadPlugins",IDC_CHECK_NPN_RELOADPLUGINS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,157,81,10 + CONTROL "NPN_GetJavaEnv",IDC_CHECK_NPN_GETJAVAENV,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,166,75,10 + CONTROL "NPN_GetJavaPeer",IDC_CHECK_NPN_GETJAVAPEER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,176,77,10 + CONTROL "NPN_GetValue",IDC_CHECK_NPN_GETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,185,65,10 + CONTROL "NPN_SetValue",IDC_CHECK_NPN_SETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,195,64,10 + CONTROL "NPN_InvalidateRect",IDC_CHECK_NPN_INVALIDATEREGION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,205,81,10 + CONTROL "NPN_InvalidateRegion",IDC_CHECK_NPNINVALIDATEREGION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,214,89,10 + CONTROL "NPN_ForceRedraw",IDC_CHECK_NPN_FORCEREDRAW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,224,78,10 + CONTROL "NPP_New",IDC_CHECK_NPP_NEW,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,22,49,10 + CONTROL "NPP_Destroy",IDC_CHECK_NPP_DESTROY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,32,59,10 + CONTROL "NPP_SetWindow",IDC_CHECK_NPP_SETWINDOW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,41,71,10 + CONTROL "NPP_NewStream",IDC_CHECK_NPP_NEWSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,51,71,10 + CONTROL "NPP_DestroyStream",IDC_CHECK_NPP_DESTROYSTREAM,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,61,81,10 + CONTROL "NPP_StreamAsFile",IDC_CHECK_NPP_STREAMASFILE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,70,75,10 + CONTROL "NPP_Write",IDC_CHECK_NPP_WRITE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,80,51,10 + CONTROL "NPP_WriteReady",IDC_CHECK_NPP_WRITEREADY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,89,72,10 + CONTROL "NPP_Print",IDC_CHECK_NPP_PRINT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,99,49,10 + CONTROL "NPP_HandleEvent",IDC_CHECK_NPP_HANDLEEVENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,109,76,10 + CONTROL "NPP_URLNotify",IDC_CHECK_NPP_URLNOTIFY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,118,67,10 + CONTROL "NPP_GetJavaClass",IDC_CHECK_NPP_GETJAVACLASS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,128,78,10 + CONTROL "NPP_GetValue",IDC_CHECK_NPP_GETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,137,64,10 + CONTROL "NPP_SetValue",IDC_CHECK_NPP_SETVALUE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,140,147,63,10 + PUSHBUTTON "&Check All",IDC_BUTTON_CHECKALL,169,198,50,14 + PUSHBUTTON "C&lear All",IDC_BUTTON_CLEARALL,169,216,50,14 +END + +IDD_PAGE_LOG DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Log" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Choose where to output",IDC_STATIC,7,7,224,66 + CONTROL "To &window",IDC_CHECK_TOWINDOW,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,23,51,10 + CONTROL "To c&onsole",IDC_CHECK_TOCONSOLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,15,37,51,10 + CONTROL "To &file",IDC_CHECK_TOFILE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,51,35,10 + EDITTEXT IDC_EDIT_FILE,52,49,152,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BUTTON_CHOOSEDIR,206,49,19,14 +END + +IDD_PAGE_ADVANCED DIALOG DISCARDABLE 0, 0, 238, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Advanced" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Shutdown immediately after the last instance destroyed", + IDC_CHECK_SPALID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 15,23,188,10 + GROUPBOX "Shutdown policy",IDC_STATIC,7,7,224,88 + LTEXT "Use this option to emulate 4.x behaviour when NP_Shutdown is called after the last plugin instance is destroyed. If this box is checked the Spy Plugin will call NP_Shutdown after NPP_Destroy is called on last instance.", + IDC_STATIC,15,39,209,33 + LTEXT "If this box is unchecked NP_Shutdown will be issued only when the Navigator commands so.", + IDC_STATIC,15,71,209,19 +END + +ID_DIALOG_CHOOSEDIR DIALOG DISCARDABLE 0, 0, 228, 143 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Choose Directory" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Directory &Name:",-1,7,9,55,8 + EDITTEXT ID_EDIT_DIR,7,20,151,13,ES_AUTOHSCROLL + LISTBOX ID_LIST_DIR,7,33,151,74,LBS_OWNERDRAWFIXED | + LBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + LTEXT "Dri&ves:",-1,7,111,26,8 + COMBOBOX ID_COMBO_DIR,7,121,151,68,CBS_DROPDOWNLIST | + CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | + WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,171,9,50,14 + PUSHBUTTON "Cancel",IDCANCEL,171,27,50,14 + LISTBOX ID_LISTTEMP_DIR,181,53,20,40,LBS_SORT | + LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | + WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_DIALOG_MAIN, DIALOG + BEGIN + BOTTOMMARGIN, 205 + END + + IDD_DIALOG_PAUSE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 57 + TOPMARGIN, 7 + BOTTOMMARGIN, 22 + END + + IDD_PAGE_GENERAL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_FILTER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_LOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END + + IDD_PAGE_ADVANCED, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 231 + TOPMARGIN, 7 + BOTTOMMARGIN, 239 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON_APP ICON DISCARDABLE "res/icon.ico" +ID_ICON_DRIVECDROM ICON DISCARDABLE "res/cdrom.ICO" +ID_ICON_DRIVEFLOPPY ICON DISCARDABLE "res/floppy.ICO" +ID_ICON_DRIVEHARD ICON DISCARDABLE "res/harddr.ICO" +ID_ICON_DRIVENETWORK ICON DISCARDABLE "res/netdr.ICO" +ID_ICON_DRIVERAM ICON DISCARDABLE "res/ramdr.ICO" +ID_ICON_FOLDERCLOSED ICON DISCARDABLE "res/foldcl.ICO" +ID_ICON_FOLDEROPEN ICON DISCARDABLE "res/foldop.ICO" +ID_ICON_OPENSELECT ICON DISCARDABLE "res/foldopse.ICO" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/modules/plugin/tools/spy/windows/profilew.cpp b/mozilla/modules/plugin/tools/spy/windows/profilew.cpp new file mode 100644 index 00000000000..dfb79abcd5a --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/profilew.cpp @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#include + +#include "profilew.h" + +ProfileWin::ProfileWin() : Profile() +{ + hKey = NULL; + char szClass[] = "SpyPluginClass"; + DWORD disp = 0L; + + LONG res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, + NPSPY_REG_SUBKEY, + 0L, + szClass, + 0L, + KEY_READ | KEY_WRITE, + NULL, + &hKey, + &disp); + + if(res != ERROR_SUCCESS) + hKey = NULL; +} + +ProfileWin::~ProfileWin() +{ + if(hKey) + RegCloseKey(hKey); +} + +BOOL ProfileWin::getBool(char * key, BOOL * value) +{ + if(!value) + return FALSE; + + DWORD size = sizeof(DWORD); + DWORD val = 1L; + LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)&val, &size); + + if(res != ERROR_SUCCESS) + return FALSE; + + *value = (val == 0L) ? FALSE : TRUE; + + return TRUE; +} + +BOOL ProfileWin::setBool(char * key, BOOL value) +{ + DWORD size = sizeof(DWORD); + DWORD val = value ? 1L : 0L; + LONG res = RegSetValueEx(hKey, key, 0L, REG_DWORD, (const BYTE *)&val, size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::getString(char * key, char * string, int size) +{ + LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)string, (DWORD *)&size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::setString(char * key, char * string) +{ + DWORD size = strlen(string); + LONG res = RegSetValueEx(hKey, key, 0L, REG_SZ, (const BYTE *)string, size); + return (res == ERROR_SUCCESS); +} + +BOOL ProfileWin::getSizeAndPosition(int *width, int *height, int *x, int *y) +{ + DWORD size = sizeof(DWORD); + LONG res = ERROR_SUCCESS; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, NULL, (BYTE *)width, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, NULL, (BYTE *)height, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_X, 0L, NULL, (BYTE *)x, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegQueryValueEx(hKey, NPSPY_REG_KEY_Y, 0L, NULL, (BYTE *)y, &size); + if(res != ERROR_SUCCESS) + return FALSE; + + return TRUE; +} + +BOOL ProfileWin::setSizeAndPosition(int width, int height, int x, int y) +{ + DWORD size = sizeof(DWORD); + LONG res = ERROR_SUCCESS; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, REG_DWORD, (const BYTE *)&width, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, REG_DWORD, (const BYTE *)&height, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_X, 0L, REG_DWORD, (const BYTE *)&x, size); + if(res != ERROR_SUCCESS) + return FALSE; + + res = RegSetValueEx(hKey, NPSPY_REG_KEY_Y, 0L, REG_DWORD, (const BYTE *)&y, size); + if(res != ERROR_SUCCESS) + return FALSE; + + return TRUE; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/profilew.h b/mozilla/modules/plugin/tools/spy/windows/profilew.h new file mode 100644 index 00000000000..ed673023ace --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/profilew.h @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __PROFILEW_H__ +#define __PROFILEW_H__ + +#include "profile.h" + +class ProfileWin : public Profile +{ + HKEY hKey; + +public: + ProfileWin(); + ~ProfileWin(); + + BOOL getBool(char * key, BOOL * value); + BOOL setBool(char * key, BOOL value); + + BOOL getString(char * key, char * string, int size); + BOOL setString(char * key, char * string); + + BOOL getSizeAndPosition(int *width, int *height, int *x, int *y); + BOOL setSizeAndPosition(int width, int height, int x, int y); +}; + +#define NPSPY_REG_SUBKEY "Software\\Netscape\\SpyPlugin" + +#define NPSPY_REG_KEY_ONTOP "AlwaysOnTop" +#define NPSPY_REG_KEY_LOGTOWINDOW "LogToWindow" +#define NPSPY_REG_KEY_LOGTOCONSOLE "LogToConsole" +#define NPSPY_REG_KEY_LOGTOFILE "LogToFile" +#define NPSPY_REG_KEY_SPALID "ShutdownPluginsAfterDestroy" +#define NPSPY_REG_KEY_WIDTH "width" +#define NPSPY_REG_KEY_HEIGHT "height" +#define NPSPY_REG_KEY_X "x" +#define NPSPY_REG_KEY_Y "y" +#define NPSPY_REG_KEY_LOGFILENAME "LogFileName" + +#endif + diff --git a/mozilla/modules/plugin/tools/spy/windows/res/cdrom.ico b/mozilla/modules/plugin/tools/spy/windows/res/cdrom.ico new file mode 100644 index 00000000000..5e2821593e9 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/cdrom.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/floppy.ico b/mozilla/modules/plugin/tools/spy/windows/res/floppy.ico new file mode 100644 index 00000000000..b4209604ae0 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/floppy.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/foldcl.ico b/mozilla/modules/plugin/tools/spy/windows/res/foldcl.ico new file mode 100644 index 00000000000..cc2ff7f6239 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/foldcl.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/foldop.ico b/mozilla/modules/plugin/tools/spy/windows/res/foldop.ico new file mode 100644 index 00000000000..10e28405b05 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/foldop.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/foldopse.ico b/mozilla/modules/plugin/tools/spy/windows/res/foldopse.ico new file mode 100644 index 00000000000..c80112e3f31 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/foldopse.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/harddr.ico b/mozilla/modules/plugin/tools/spy/windows/res/harddr.ico new file mode 100644 index 00000000000..04fe5a5a493 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/harddr.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/icon.ico b/mozilla/modules/plugin/tools/spy/windows/res/icon.ico new file mode 100644 index 00000000000..dc53279e9b9 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/icon.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/netdr.ico b/mozilla/modules/plugin/tools/spy/windows/res/netdr.ico new file mode 100644 index 00000000000..f3387d22463 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/netdr.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/res/ramdr.ico b/mozilla/modules/plugin/tools/spy/windows/res/ramdr.ico new file mode 100644 index 00000000000..ac11f68ced3 Binary files /dev/null and b/mozilla/modules/plugin/tools/spy/windows/res/ramdr.ico differ diff --git a/mozilla/modules/plugin/tools/spy/windows/resource.h b/mozilla/modules/plugin/tools/spy/windows/resource.h new file mode 100644 index 00000000000..5a16757edbf --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/resource.h @@ -0,0 +1,91 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by npspy.rc +// +#define IDD_DIALOG_OPTIONS 101 +#define IDI_ICON1 102 +#define IDI_ICON_APP 102 +#define ID_DIALOG_CHOOSEDIR 102 +#define IDD_DIALOG_PAUSE 103 +#define ID_ICON_DRIVEFLOPPY 103 +#define IDD_PAGE_GENERAL 104 +#define ID_ICON_DRIVEHARD 104 +#define IDD_PAGE_FILTER 105 +#define ID_ICON_DRIVENETWORK 105 +#define IDD_PAGE_LOG 106 +#define ID_ICON_DRIVECDROM 106 +#define IDD_PAGE_ADVANCED 107 +#define ID_ICON_DRIVERAM 107 +#define ID_ICON_FOLDERCLOSED 108 +#define ID_ICON_FOLDEROPEN 109 +#define ID_ICON_OPENSELECT 110 +#define IDD_MAIN 308 +#define IDD_DIALOG_MAIN 308 +#define IDC_MAIN_OUTPUT 1001 +#define IDC_CHECK_NPN_VERSION 1002 +#define IDC_CHECK_NPN_GETURLNOTIFY 1003 +#define ID_EDIT_DIR 1003 +#define IDC_CHECK_NPNGETURL 1004 +#define IDC_CHECK_NPN_GETURL 1004 +#define ID_LIST_DIR 1004 +#define IDC_CHECK_NPN_POSTURLNOTIFY 1005 +#define ID_COMBO_DIR 1005 +#define IDC_CHECK_NPN_POSTURL 1006 +#define ID_LISTTEMP_DIR 1006 +#define IDC_CHECK_NPN_REQUESTREAD 1007 +#define IDC_CHECK_NPN_NEWSTREAM 1008 +#define IDC_CHECK_NPN_WRITE 1009 +#define IDC_CHECK_NPN_DESTROYSTREAM 1010 +#define IDC_CHECK_NPN_STATUS 1011 +#define IDC_CHECK_NPN_ESERAGENT 1012 +#define IDC_CHECK_NPN_MEMALLOC 1013 +#define IDC_CHECK_NPN_MEMFREE 1014 +#define IDC_CHECK_NPN_MEMFLUSH 1015 +#define IDC_CHECK_NPN_RELOADPLUGINS 1016 +#define IDC_CHECK_NPNGETJAVAENV 1017 +#define IDC_CHECK_NPN_GETJAVAENV 1017 +#define IDC_CHECK_NPN_GETJAVAPEER 1018 +#define IDC_CHECK_NPN_GETVALUE 1019 +#define IDC_CHECK_NPN_SETVALUE 1020 +#define IDC_CHECK_NPN_INVALIDATERECT 1021 +#define IDC_CHECK_NPN_INVALIDATEREGION 1021 +#define IDC_CHECK_NPNINVALIDATEREGION 1022 +#define IDC_CHECK_NPN_FORCEREDRAW 1023 +#define IDC_CHECK_NPP_NEW 1024 +#define IDC_CHECK_NPP_DESTROY 1025 +#define IDC_CHECK_NPP_SETWINDOW 1026 +#define IDC_CHECK_NPP_NEWSTREAM 1027 +#define IDC_CHECK_NPP_DESTROYSTREAM 1028 +#define IDC_CHECK_NPP_STREAMASFILE 1029 +#define IDC_CHECK_NPP_WRITEREADY 1030 +#define IDC_CHECK_NPP_WRITE 1031 +#define IDC_CHECK_NPP_PRINT 1032 +#define IDC_CHECK_NPP_HANDLEEVENT 1033 +#define IDC_CHECK_NPP_URLNOTIFY 1034 +#define IDC_CHECK_NPP_GETJAVACLASS 1035 +#define IDC_CHECK_NPP_GETVALUE 1036 +#define IDC_CHECK_NPP_SETVALUE 1037 +#define IDC_BUTTON_CHECKALL 1038 +#define IDC_BUTTON_CLEARALL 1039 +#define IDC_CHECK_TOCONSOLE 1041 +#define IDC_CHECK_TOWINDOW 1042 +#define IDC_CHECK_TOFILE 1043 +#define IDC_CHECK_SPALID 1044 +#define IDC_EDIT_FILE 1047 +#define IDC_BUTTON_CHOOSEDIR 1048 +#define IDC_CHECK_MUTE 2019 +#define IDC_CHECK_ONTOP 2020 +#define IDC_BUTTON_OPTIONS 2023 +#define IDC_BUTTON_CLEAR 2024 +#define IDC_OUTPUT 2026 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1049 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/modules/plugin/tools/spy/windows/setupexe.cpp b/mozilla/modules/plugin/tools/spy/windows/setupexe.cpp new file mode 100644 index 00000000000..49fcdaf708c --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/setupexe.cpp @@ -0,0 +1,8 @@ +#include +#include "setup.h" + +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + SPY_Setup(); + return 0; +} diff --git a/mozilla/modules/plugin/tools/spy/windows/spysetup.dsp b/mozilla/modules/plugin/tools/spy/windows/spysetup.dsp new file mode 100644 index 00000000000..4cc31cdd068 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/spysetup.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="spysetup" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=spysetup - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "spysetup.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "spysetup.mak" CFG="spysetup - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "spysetup - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "spysetup - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spysetup - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "spysetup - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "spysetup___Win32_Debug" +# PROP BASE Intermediate_Dir "spysetup___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../include" /D "XP_WIN" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib debug/npspy.lib /nologo /subsystem:windows /debug /machine:I386 /out:"..\..\..\..\dist\WIN32_D.OBJ\bin\plugins\spysetup.exe" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "spysetup - Win32 Release" +# Name "spysetup - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\setupexe.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/mozilla/modules/plugin/tools/spy/windows/windowsxx.h b/mozilla/modules/plugin/tools/spy/windows/windowsxx.h new file mode 100644 index 00000000000..a9d90bd522d --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/windowsxx.h @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +#ifndef __WINDOWSXX_H__ +#define __WINDOWSXX_H__ + +/* void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr) */ +#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \ + (fn)((hwnd), (int)(wParam), (LPNMHDR)lParam) + +#endif diff --git a/mozilla/modules/plugin/tools/spy/windows/winentry.cpp b/mozilla/modules/plugin/tools/spy/windows/winentry.cpp new file mode 100644 index 00000000000..7f2efd4e624 --- /dev/null +++ b/mozilla/modules/plugin/tools/spy/windows/winentry.cpp @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * + */ + +// Windows entry point. Mainly for debug purposes. +#include + +char szAppName[] = "NPSpy"; +HINSTANCE hInst = NULL; + +BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) +{ +#ifdef DEBUG + char szReason[80]; + + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + strcpy(szReason, "DLL_PROCESS_ATTACH"); + break; + case DLL_THREAD_ATTACH: + strcpy(szReason, "DLL_THREAD_ATTACH"); + break; + case DLL_PROCESS_DETACH: + strcpy(szReason, "DLL_PROCESS_DETACH"); + break; + case DLL_THREAD_DETACH: + strcpy(szReason, "DLL_THREAD_DETACH"); + break; + } +#endif + + hInst = hDLL; + return TRUE; +}