home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 April / CHIP_CD_2005-04.iso / software / netv / NVinst.exe / $INSTDIR / nvplugn.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-02-22  |  21.7 KB  |  434 lines

  1. //************************************
  2. //*NetView plug-ins header file v2.82*
  3. //*     (c)Killer{R} 17.11.2004 Rev F*
  4. //************************************
  5. #ifndef nvplugh
  6. #define nvplugh
  7.  
  8.  
  9. //------------------------------------------------
  10. //NMPN_IMAGES
  11. //Use this message to obtain any NetView interface-specified
  12. //images such as indexed menus images loaded from images.bmp
  13. //and shared and ftp resource name assotiated images
  14. //HICON's returned are owned by NetView so plug-in shouldn't
  15. //destroy it after use
  16. #define NVIMAGES_GETRESIMG    0x01//Retrieves HICON associated to given resource name in NetView settings
  17.                                   ///lParam - points to NULL-terminated resourcename string
  18.                                   ///returns HICON as result or NULL if no icon associated
  19.  
  20. #define NVIMAGES_GETRESIMGCH  0x02//Same as NVIMAGES_GETRESIMG but "cached resource" image will be returned
  21.  
  22. #define NVIMAGES_GETNVIMG     0x03//Retrieves HICON of internal NetView image associated to given index
  23.                                   ///Icons are images extracted from images.bmp on startup
  24.                                   ///lParam specifies icon index as zero-based image number in images.bmp
  25.                                   ///returns HICON as result
  26.  
  27. //------------------------------------------------
  28. //NMNP_HOSTMSG
  29. //Sent by NetView to plug-ins and scripts when
  30. //user double clicked on the host with specified
  31. //and enabled "hostmsg://NNN" command on advanced page
  32. //of host's edition dialog. wParam - user specified
  33. //number NNN. lParam - host's id.
  34.  
  35.  
  36. //------------------------------------------------
  37. //NMPN_TRYAUTH
  38. //Used to authorize self on local computer using stored in metavariables user and password or using
  39. //random-generated username
  40. //if wParam = 0:
  41. ///try authorize host with stored username and password in variables
  42. ///"user" and "pass". If no user/pass stored do nothing
  43. //if wParam = 1:
  44. ///try authorize host with stored username and password in variables
  45. ///"user" and "pass". If no user/pass stored try random username
  46. //lParam - host's ID
  47.  
  48. //------------------------------------------------
  49. //NMPN_GETRESLIST
  50. //Used to get NETBIOS or FTP resourcelist of specified hostname
  51. //NETBIOS and FTP settings determined by general NetView's settings
  52. //and host's individual settings
  53. //Flags for wParam:
  54. #define NVRESLIST_FTP     0 //get FTP resources (if enabled by settings)
  55. #define NVRESLIST_NETBIOS 1 //get NETBIOS resources (if enabled by settings)
  56. #define NVRESLIST_USEID   2 //bitmask flag, can be used with one of above, tells
  57.                             ///NetView to use NVRESLIST::host.id
  58.                             ///(if not specified NVRESLIST::host.name used)
  59.  
  60. //lParam points to NVRESLIST structure. If thereis not enough buffer length
  61. //to place result message returns 2 and set buflen field to neccessary length.
  62. //In case of success returns 1. By the way if hosts has no resources or if network
  63. //error occured message returns 1, but resourcelist contains only character '\1'
  64. //If other error occured returns 0
  65.  
  66.  
  67.  
  68. //------------------------------------------------
  69. //NMPN_CALLBACK
  70. //Used to set plugins callback functions to handle event of recheck host with
  71. //disabled default rechecks or to make some work on every host's SETSTATE event
  72. //lParam points to such callback function :
  73. //LRESULT CALLBACK NVCallBackProc(DWORD EventCode, DWORD ObjId, void *Reserved)
  74. //EventCode - event code: NVCB_CUSTOM_RECHECK or NVCB_PRE_SETSTATE (see below)
  75. //ObjId     - host's id 
  76. //function must return 1
  77. //Flags in wParam:
  78. #define NVCB_CUSTOM_RECHECK       0x0001//to enable notifies on recheck of hosts
  79.                                         ///with disabled default recheck mechanism
  80. #define NVCB_PRE_SETSTATE         0x0002//to enable notifies just before hosts setstate
  81. #define NVCB_REMOVECALLBACK       0x1000//use to remove callback function or disable some events
  82.  
  83.  
  84. //------------------------------------------------
  85. //NMPN_NVCTL
  86. //wParam=0;lParam=0 - shows and activates main NetView window
  87. //wParam=1;lParam points to MSG structure. Message in MSG will
  88. // be broadcasted to all currently loaded plugins
  89.  
  90. //------------------------------------------------
  91. //NMPN_PLUGINEX -used to connect external process as plugin
  92. //wParam
  93. //0 to query NetView info by external process
  94. //1 to remove thread from NetView's plugins list
  95. //2 to add thread to NetView's plugins list
  96. //lParam points to NVPLUGININFO structure
  97. //process must allocate this structure
  98. //process must allocate NVPLUGINGOINFO structure and set pointer to it in NVPLUGININFO.goinfo
  99. //process nust allocate and free all structrures in address space of NetView, by using
  100. //VirtualAllocEx/VirtualFreeEx, read and write memory by ReadProcessMemory/WriteProcessMemory
  101. //process must correctly remove itself from plugins list on exiting and when received WM_QUIT
  102. //from NetView to avoid blocking NetView on exit
  103.  
  104. //------------------------------------------------
  105. //NetView sets this flags in NMNP_ALERT as wParam
  106. //lParam depends on alert type
  107. #define NVALERT_NETWATCHER   0x00000001//NetWatcher detected user connection, lParam - host id or NULL
  108. #define NVALERT_ALARMHOST    0x00000002//Alarm host in host list goes up or down, lParam - host id or NULL
  109. #define NVALERT_TERMINAL     0x00000003//Terminal accepted client in server mode, lParam - host id or NULL
  110. #define NVALERT_REDIRECTOR   0x00000004//Redirector accepted client, lParam - host id or NULL
  111. #define NVALERT_IPLOGGER     0x00000005//IP logger detected activity or flood atack,
  112. #define NVALERT_NETSEARCHER  0x00000006//NetSearcher event send on end searching
  113. #define NVALERT_RESSCANER    0x00000007//Resources Searcher event send on end of scan
  114.  
  115. #define NVALERTMASK_CANCEL   0x00040000//bitmask. If set continious event has been finished.(Alarmhost goes down, NetWatcher - user disconnected, Terminal, Redirector - client disconnected, IP logger - no portlistener activity, NVALERT_ALARMHOST - user clicks on alarmed host)
  116.  
  117. #define NVALERTMASK_NWBLACK  0x00010000//NVALERT_NETWATCHER
  118. #define NVALERTMASK_NWWHITE  0x00020000//masks
  119. #define NVALERTMASK_NWSKIP   0x00080000//
  120.  
  121. #define NVALERTMASK_ILLIST   0x00010000///////
  122. #define NVALERTMASK_ILICMP   0x00020000//NVALERT_IPLOGGER
  123. #define NVALERTMASK_ILSYN    0x00080000//masks
  124. #define NVALERTMASK_ILUDP    0x00100000///////
  125.  
  126. #define NVALERTMASK_HOSTUP   0x00010000//NVALERT_ALARMHOST
  127. #define NVALERTMASK_HOSTDOWN 0x00020000//masks
  128.  
  129. //------------------------------------------------
  130. //use with NMPN_OBJECT
  131. //lParam points to NVHOST, NVLIST, NVLINE or NVAREA structures(or even represents objects IDs)
  132. //wParam:
  133.  
  134. #define NVOBJ_SELECTED       0x10000//Use with NVOBJ_GETHOST - to get list of selected hosts
  135.                                     ///or NVOBJ_GETLIST to get currently active hostlist
  136.                                     ///(id will be set to NULL if there is no active hostlist's window)
  137. #define NVOBJ_FORCENEW       0x20000//Use with NVOBJ_HOSTBYTEXT and NVOBJ_LISTBYTEXT
  138. #define NVOBJ_HOSTNOIP       0x40000//Use with NVOBJ_HOSTBYTEXT|NVOBJ_FORCENEW to add host
  139.                                     //with empty IP preventing any resolving
  140.                                     //you can add host with random name and empy IP then
  141.                                     //make it static and set true name and IP
  142. #define NVOBJ_GETHOST        0x00001//set id to NULL to get first host
  143.                                     ///selected hosts will be returned if NVOBJ_SELECTED
  144. #define NVOBJ_SETHOST        0x00002//set id to NULL to add new host
  145.                                     ///Note that if exists host with same name or IP
  146.                                     ///it will be rescanned and returned
  147. #define NVOBJ_DELHOST        0x00004
  148. #define NVOBJ_HOSTBYTEXT     0x00008//lp points to hostname or ip address. Message returns host id
  149.                                     ///if NVOBJ_FORCENEW specified new host will be created
  150.  
  151. //
  152. #define NVOBJ_GETLIST        0x00010//set id to zero to get first list
  153. #define NVOBJ_SETLIST        0x00020//set id to zero to create new list.
  154.                                     ///Note that if exists list with same name it will be returned
  155. #define NVOBJ_DELLIST        0x00040//lParam represents list id
  156. #define NVOBJ_LISTBYTEXT     0x00080//lParam points to mapname, can be used with NVOBJ_FORCENEW
  157.                                     ///Message returns list id
  158.  
  159.  
  160.  
  161. #define NVOBJ_GETLINE        0x00100//Set index field in NVLINE structure.
  162.                                     ///Message result equals total line count.
  163. #define NVOBJ_SETLINE        0x00200//Set index field in NVLINE structure. Set Index to -1 to add new line.
  164.                                     ///Message result equals total line count after. Set Nodes to -1 to allow
  165.                                     ///user to add nodes manually (first line node will be placed on the last
  166.                                     ///right-mouse click position). Note that if Nodes=-1  then line's hostlist
  167.                                     ///will be activated and switched to Visual Map mode, if not in it
  168. #define NVOBJ_DELLINE        0x00400//Set lParam to index of line to be deleted.
  169.                                     ///Message result equals total line count after.
  170.  
  171.  
  172. #define NVOBJ_GETAREA        0x00800//set id to zero to get first area
  173.                                     //return id if success or 0 if error occured
  174. #define NVOBJ_SETAREA        0x01000//set id to zero to create new area if there is no area with the same name on the same map
  175.                                     ///Note that if exists area with same name on specified map it will be returned
  176.                                     //return id if success or 0 or -1 if error occured
  177. #define NVOBJ_DELAREA        0x02000//lParam represents area's id
  178.                                     //return 1 if success or 0 if error occured
  179.  
  180.  
  181. //------------------------------------------------
  182.  
  183.  
  184. //use with NMPN_MENU
  185. //wParam      MENUACTION_SET|MENUACTION_DEL|MENUACTION_SPLIT
  186. //lParam      LPNVMENUINFO  |DWORD id
  187. #define NVMENUACTION_SET   0//set id to zero to create new menu item and it's id will be returned
  188. #define NVMENUACTION_DEL   1//deletes menu item
  189. #define NVMENUACTION_SPLIT 2//split menu submenu items to fit in screen 
  190. #define NVMENUFLAG_MAIN     0x01//Menu item will be appeared in Plug-ins submenu. This flag only used when creating non-submenu item.
  191. #define NVMENUFLAG_CONTEXT  0x02//Menu item will be appeared in context menu. This flag only used when creating non-submenu item.
  192. #define NVMENUFLAG_TRAY     0x04//Menu item will be appeared in tray icon popup menu. This flag only used when creating non-submenu item.
  193. #define NVMENUFLAG_DISABLED 0x08//Menu item will be appeared as disabled
  194. #define NVMENUFLAG_CHECKED  0x10//Menu item will be appeared as checked
  195. #define NVMENUFLAG_SORTED   0x20//Menu item will be added at sorted position
  196. //------------------------------------------------
  197. //use with NMPN_METAVAR
  198. //wParam = {NVMETAVAR_GET,NVMETAVAR_SET}
  199. //lParam LPNVMETAVAR
  200. #define NVMETAVAR_GET 0
  201. //return 1 if success
  202. //return 0 if fail
  203. //return 2 if vallen too small to acomodate all data. Vallen on return equals data length
  204. #define NVMETAVAR_SET 1
  205. //return 1 if success
  206. //return 0 if fail
  207. #define NVMETAVAR_USEID 2
  208. //Bit flags, is set then use "id" instead of "name" field of "host" union in NVMETAVAR structure
  209.  
  210. //------------------------------------------------
  211. //NMPN_ACTION and NMNP_ACTION
  212. //bitmask for wParam
  213.  
  214. //group flags
  215. #define NVACTION_GETFROMNET  0x01//!use only when NVACTION_LIST specified
  216. #define NVACTION_GETFROMFILE 0x02//!use only when NVACTION_LIST specified
  217.                                  ///lParam contains (char *) - path to LMHOSTS
  218.                                  ///to import or NULL - default will be used
  219. #define NVACTION_RECHECK     0x08//if NVACTION_LIST not specified
  220.                                  ///lParam contains ListView host id
  221.                                  ///otherwise list id or NULL to recheck all lists
  222. #define NVACTION_RETRACE     0x1000//if NVACTION_LIST not specified lParam contains list id or hostid
  223.  
  224. #define NVACTION_CLEARLIST   0x2000//lParam contains id of list to be deleted or NULL to clear entire list
  225.  
  226. #define NVACTION_LIST        0x20//if not set means single host action
  227. ///
  228.  
  229. //single flags
  230. #define NVACTION_ACTIVATE    0x8000//Main netview window status changed lParam
  231.                                    ///equals wParam in WM_ACTIVATE message sent
  232.                                    ///to main window by system
  233.  
  234. #define NVACTION_MENUPOPUP   0x10000//NetView sends this message when plug-ins menu, tray menu or context menu popups
  235.                                     //lParam equals NVMENUFLAG_MAIN, NVMENUFLAG_CONTEXT or NVMENUFLAG_TRAY
  236.                                     //plugin can use this notification to dynamically enable/disable its menu items
  237.  
  238. #define NVACTION_OPEN        0x10//lParam contains host item id
  239.  
  240.  
  241. #define NVACTION_OPENPATH    0x80000//lParam points to path to be opened
  242.  
  243. #define NVACTION_SAVELMHOSTS 0x100//use to save entire hostlist to specified file
  244.                                   ///lParam contains pointer to file path\name
  245.                                   ///or NULL - default LMHOSTS will be saved
  246.                                   ///!All other flags should be not set
  247.  
  248. #define NVACTION_SETSTATE   0x400//lParam=0 Resets current state of NetView:
  249.                                  ///lParam=hostid - redraws host on list
  250.  
  251. #define NVACTION_SETTINGS   0x800//lParam=0 - notifies plug-in that global settings has been changed by user
  252.  
  253. #define NVACTION_EDIT       0x20000 //lParam contains host id to edit
  254.  
  255. #define NVACTION_IMGEXPORT   0x40000//lParam contains exported list id
  256.                                     ///this message can be sent by plugin to initiate export
  257.                                     ///returns 1 if initiate export succed
  258.                                     ///NetView sends this message when list has been exported
  259.  
  260. #define NVACTION_LOCKSAVE   0x100000//lParam = 1 - to increment saving hostlist locks counter
  261.                                     ///lParam = 0 - to decrement saving hostlist locks counter
  262.                                     ///lParam = 2 - do nothing, only return current locks counter
  263.                                     ///NetView allow user to save hostlist if current locks counter is zero
  264.                                     ///if autosave hostlist enabled and locks counter on NetView exit
  265.                                     ///is not zero then hostlist will not be saved automatically on exit
  266.                                     ///plug-in can increment locks counter before doing some integrity-critical
  267.                                     ///task and decrement it after task is completed to prevent saving hostlist
  268.                                     ///with incorrect data. For example NetView sets lock before loading hostlist
  269.                                     ///from file and decrements counter after load finished
  270.  
  271. ///
  272.  
  273. //followed bitmasks sets by NetView in wParam with NVACTION_OPEN and NVACTION_RECHECK
  274. //only when NVACTION_LIST not set (single open/recheck host) lParam in this case
  275. //represents hostitem id or NULL if no item associated
  276. #define NVACTION_RESULTONLINE  0x40
  277. #define NVACTION_RESULTOPENED  0x80
  278. //-------------------------------------------------
  279.  
  280.  
  281. //-------------------------------------------------
  282. //-------------------------------------------------
  283. //-----------------------Control codes definitions-
  284. //plugin->netview main window main codes
  285. //Use as 1st parameter in NVPLUGINGOINFO::nvcall (SendMessage available for compatibility))
  286. #define NMPN_MENU          WM_USER+0x401
  287. #define NMPN_METAVAR       WM_USER+0x402
  288. #define NMPN_ACTION        WM_USER+0x403
  289. #define NMPN_GETSHARELIST  WM_USER+0x404
  290. #define NMPN_GETRESLIST    WM_USER+0x405
  291. #define NMPN_TRYAUTH       WM_USER+0x406
  292. #define NMPN_OBJECT        WM_USER+0x407
  293. #define NMPN_IMAGES        WM_USER+0x408
  294. #define NMPN_PLUGINEX      WM_USER+0x409
  295. #define NMPN_CALLBACK      WM_USER+0x40A
  296. #define NMPN_NVCTL         WM_USER+1215
  297.  
  298.  
  299. //netview->plugin main thread
  300. //NetView posts this messabes to plug-ins thread by PostThreadMessage)
  301. #define NMNP_ACTION        WM_USER+0x403
  302. #define NMNP_HOSTMSG       WM_USER+0x404
  303. #define NMNP_ALERT         WM_USER+0x406
  304. //--------------------------------------------structures
  305. typedef struct _NVHOST
  306. {
  307. char hostname[128];
  308. char hostip[64];
  309. DWORD id;                           //set this value to zero to get first host.
  310. DWORD nextid;
  311. DWORD color;                        //item color in list
  312. DWORD res[4];
  313. bool selected;                      //item is selected in list
  314. }NVHOST,*LPNVHOST;
  315. typedef struct _NVLIST
  316. {
  317. char name[128];
  318. char theme[128];
  319. char ltype[128];
  320. char llength[128];
  321. char lspeed[128];
  322. char lnote[128];
  323. int  w[32];
  324. DWORD id;
  325. DWORD nextid;
  326. DWORD reserved[128];
  327. }NVLIST,*LPNVLIST;
  328. typedef struct _NVLINE
  329. {
  330. int index;
  331. int x[32];//nodes points
  332. int y[32];///
  333. int nodes;//nodes count
  334. DWORD color;
  335. int flags;
  336. int width;
  337. char ltype[128];
  338. char llength[128];
  339. char lspeed[128];
  340. char lnote[128];
  341. char mapname[128];
  342. DWORD selnode;
  343. DWORD reserved[127];
  344. }NVLINE,*LPNVLINE;
  345. typedef struct _NVAREA
  346. {
  347. RECT bounds;
  348. DWORD color;
  349. char hint[256];
  350. char name[256];
  351. char mapname[128];
  352. DWORD id;
  353. DWORD nextid;
  354. DWORD reserved[128];
  355. }NVAREA,*LPNVAREA;
  356. typedef struct _NVRESLIST
  357. {
  358. union
  359.  {
  360.  char name[128];//hostname which resources list to retrieve
  361.  DWORD id;//if NVRESLIST_USEID specified
  362.  }host;
  363. DWORD reserved[8];
  364. int buflen;
  365. char bufdata[];
  366. }NVRESLIST,*LPNVRESLIST;
  367.  
  368.  
  369.  
  370. typedef struct _NVMENUINFO{DWORD id;       //After NVMENUACTION_SET call with id=0 id
  371.                                            //will be contain menu handle wich can be
  372.                                            //used in subsequent calls NVMENUACTION_SET
  373.                                            //or NVMENUACTION_DEL
  374.                            DWORD msg;      //Message to send to plug-in's thread on click
  375.                            DWORD tid;      //ThreadId to wich send message
  376.                            HICON icon;     //HANDLE to icon or NULL
  377.                            DWORD parentid; //id of the parent menu item or NULL.
  378.                                            //If it is not NULL NVMENUFLAG_MAIN,NVMENUFLAG_CONTEXT,NVMENUFLAG_TRAY
  379.                                            //doesn't matter when creating menu item
  380.                            char text[64];  //item text
  381.                            DWORD flags;    //see NVMENUFLAG_######
  382.                            char reserved[256];//set to zero
  383.                            }NVMENUINFO,*LPNVMENUINFO;
  384. typedef struct _NVMETAVAR{
  385.                           union
  386.                            {
  387.                            char name[128];//hostname which metavariable set or retrieve
  388.                            DWORD id;//if
  389.                            }host;
  390.                           char varname[64];  //variable name. Cannot contain characters
  391.                                              //'#', '$', #0, #13
  392.                           int vallen;        //length of the variable data
  393.                           char val[];        //variable data. Cannot contain characters
  394.                                              //'#', '$', #0, #13
  395.                           }NVMETAVAR,*LPNVMETAVAR;
  396. typedef struct _NVVERSION{unsigned char hi;unsigned char lo;}NVVERSION,*LPNVVERSION;
  397.  
  398. typedef DWORD (WINAPI *NVUPCALL)(//This function must be used instead of SendMessage since NetView v2.82
  399.                                  DWORD ThreadId,//Plug-in's main thread (in what NVPLUGINGO executed)
  400.                                  DWORD Msg,     //NetView call's code (NMPN_...)
  401.                                  DWORD wParam,  //call-specific parameter, usually call flags
  402.                                  DWORD lParam   //call-specific parameter, usually object ID or pointer
  403.                                  );
  404. typedef struct _NVPLUGINGOINFO{
  405.                               HWND nvwnd;             //NetView's plug-in messages processing window hanle
  406.                                                       //use as the 1st parameter in SendMessage
  407.                               HWND nvmainwnd;         //NetView's main window hanle
  408.                               char *inipath;          //path to NetView .ini file
  409.                               char *exepath;          //path and name of NetView.exe file
  410.                               NVUPCALL nvcall;        //SendMessage substitude for call NetView's APIs since NV2.82
  411.                               char reserved[160];
  412.                               }NVPLUGINGOINFO,*LPNVPLUGINGOINFO;
  413. typedef struct _NVPLUGININFO{
  414.                             NVVERSION nvver;//NetView sets this field to it's version
  415.                             NVVERSION retver;//Plug-in should sets this field to it's version
  416.                             char plname[64]; //plug-in name
  417.                             char retstr[128];//plug-in description
  418.                             LPNVPLUGINGOINFO goinfo; //used only with NMPN_PLUGINEX. External thread must allocate this structure
  419.                             DWORD tid;               //used only with NMPN_PLUGINEX. External thread ID.
  420.                             char reserved[244];      //set to zero
  421.                             }NVPLUGININFO,*LPNVPLUGININFO;
  422.  
  423.  
  424.  
  425. //plugin exported functions--------------------
  426.  
  427. typedef DWORD (WINAPI *NVPLUGINGETINFO)(LPNVPLUGININFO);//export name NVPluginGetInfo
  428.  
  429. typedef DWORD (WINAPI *NVPLUGINGO)(LPNVPLUGINGOINFO);   //export name NVPluginGo
  430.  
  431. typedef DWORD (WINAPI *NVPLUGINCONFIG)(void *reserved); //export name NVPluginConfig
  432.                                                         //plugin can don't export this
  433. #endif
  434.