aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Net.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/Net.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
Diffstat (limited to 'CPP/Windows/Net.h')
-rw-r--r--CPP/Windows/Net.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/CPP/Windows/Net.h b/CPP/Windows/Net.h
new file mode 100644
index 0000000..7b60b1b
--- /dev/null
+++ b/CPP/Windows/Net.h
@@ -0,0 +1,86 @@
1// Windows/Net.h
2
3#ifndef __WINDOWS_NET_H
4#define __WINDOWS_NET_H
5
6#include "../Common/MyString.h"
7
8namespace NWindows {
9namespace NNet {
10
11struct CResourceBase
12{
13 DWORD Scope;
14 DWORD Type;
15 DWORD DisplayType;
16 DWORD Usage;
17 bool LocalNameIsDefined;
18 bool RemoteNameIsDefined;
19 bool CommentIsDefined;
20 bool ProviderIsDefined;
21};
22
23struct CResource: public CResourceBase
24{
25 CSysString LocalName;
26 CSysString RemoteName;
27 CSysString Comment;
28 CSysString Provider;
29};
30
31#ifdef _UNICODE
32typedef CResource CResourceW;
33#else
34struct CResourceW: public CResourceBase
35{
36 UString LocalName;
37 UString RemoteName;
38 UString Comment;
39 UString Provider;
40};
41#endif
42
43class CEnum
44{
45 HANDLE _handle;
46 bool _handleAllocated;
47 DWORD Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCE netResource);
48 DWORD Next(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize);
49 #ifndef _UNICODE
50 DWORD Open(DWORD scope, DWORD type, DWORD usage, LPNETRESOURCEW netResource);
51 DWORD NextW(LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize);
52 #endif
53protected:
54 bool IsHandleAllocated() const { return _handleAllocated; }
55public:
56 CEnum(): _handleAllocated(false) {}
57 ~CEnum() { Close(); }
58 DWORD Close();
59 DWORD Open(DWORD scope, DWORD type, DWORD usage, const CResource *resource);
60 DWORD Next(CResource &resource);
61 #ifndef _UNICODE
62 DWORD Open(DWORD scope, DWORD type, DWORD usage, const CResourceW *resource);
63 DWORD Next(CResourceW &resource);
64 #endif
65};
66
67DWORD GetResourceParent(const CResource &resource, CResource &parentResource);
68#ifndef _UNICODE
69DWORD GetResourceParent(const CResourceW &resource, CResourceW &parentResource);
70#endif
71
72DWORD GetResourceInformation(const CResource &resource,
73 CResource &destResource, CSysString &systemPathPart);
74#ifndef _UNICODE
75DWORD GetResourceInformation(const CResourceW &resource,
76 CResourceW &destResource, UString &systemPathPart);
77#endif
78
79DWORD AddConnection2(const CResource &resource, LPCTSTR password, LPCTSTR userName, DWORD flags);
80#ifndef _UNICODE
81DWORD AddConnection2(const CResourceW &resource, LPCWSTR password, LPCWSTR userName, DWORD flags);
82#endif
83
84}}
85
86#endif