home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 September / CHIP_CD_2004-09.iso / bonus / soft_rev / files / NVinst.exe / $INSTDIR / nvplugn.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-08-04  |  18.1 KB  |  377 lines

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