// Net.h: interface for the Net class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "Worker.h"
#ifdef UNICODE
#define FORCE_UNICODE
#endif
#include <Lmshare.h>
#define IP_STR_LEN 16
class Network : public CWorker {
public:
bool LoadAsync(LPTSTR file);
Network(HWND control);
bool Load(LPCTSTR file);
bool Save(LPCTSTR file);
~Network();
private:
static DWORD LoadThread(Network* This);
void Init();
void Work();
bool EnumRecurse(NETRESOURCE * resource );
LPTSTR filename;
};
class DirectScan : public CWorker {
public:
DirectScan(HWND control);
~DirectScan();
void SetScanRange(IN_ADDR from_IP, IN_ADDR to_IP);
void Draw(LPNMTVCUSTOMDRAW tv, PCOLUMNS cols);
private:
typedef struct CHECK_IP_STRUCT {
IN_ADDR IP;
DirectScan * This;
} CHECK_IP_STRUCT;
static DWORD CheckIP(CHECK_IP_STRUCT * IP);
void Init();
void Work();
IN_ADDR IP_from,
IP_to,
IP_cur;
};
class Domain : public CWorker {
public:
Domain(LPCTSTR domain, HWND control);
Domain(HANDLE file, CWorker* parentnode, HWND control);
~Domain();
private:
void Work();
};
class Computer : public CWorker {
public:
bool Ping();
int Filter(CToken *filter, int col);
bool Save(HANDLE file);
int GetIPName(LPTSTR outbuf, int len);
LPCTSTR GetIPName();
void Draw(LPNMTVCUSTOMDRAW tv, PCOLUMNS cols);
Computer(LPCTSTR ComputerName, HWND control);
Computer(IN_ADDR ComputerIP, HWND control );
Computer(HANDLE file, CWorker* parentnode, HWND control);
~Computer();
int ResolveIP(bool async, bool refresh=false); // return Socket Error
//unsigned long __stdcall Computer::ResolveIP(void*);
private:
bool HasLoginAdmin;
HANDLE icmp;
bool TryLogin(LPCTSTR host = NULL);
static DWORD WINAPI ResolveIP_Thread(Computer* This);
TCHAR IP_str[IP_STR_LEN]; // XXX.XXX.XXX.XXX + 0
IN_ADDR IP_inet;
void Work();
};
class Share : public CWorker {
public:
void Draw(LPNMTVCUSTOMDRAW tv, PCOLUMNS cols);
void FullName(LPTSTR buf);
LPTSTR FullName();
bool Search(LPCTSTR mask, DWORD minSizeMB, DWORD maxSizeMB);
Share(LPCTSTR share, HWND control);
Share(HANDLE file, CWorker* parentnode , HWND control);
~Share();
LPCTSTR operator[](unsigned idx) const;
inline unsigned GetCount();
inline bool HasAnything();
//LPCTSTR fullname;
private:
LPTSTR* found;
unsigned found_count;
unsigned found_alloc;
void Work();
bool SearchRecursive(LPCTSTR mask);
bool AddString(LPCTSTR item);
LPCTSTR FindString(LPCTSTR item);
void ClearStrings();
CTokenFile *search;
LPCTSTR current;
}; // EnumerateComputer