|
What means "container" on a LAN?
(in the description of "NETRESOURCE" in MSDN)
Is a shared file folder a "container"?
Is a "Work Group" a "container"?
Thanks.
Maer
|
|
|
|
|
A workgroup is surely a RESOURCEUSAGE_CONTAINER, but I think a shared directory or printer is not.
Btw, have a look at this article: http://www.codeproject.com/treectrl/networktreectrl.asp
It may help you to understand how to call WNetOpenEnum.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Thanks again my pal.
I have read your article you introduced to me. It helps a lot.
But I still have a question, that is, are there any other typies of "container" besides "Work Group" on the LAN?
Best regards.
Maer
|
|
|
|
|
Well, I don't know
This is from WinNetWk.h:
#define RESOURCEDISPLAYTYPE_GENERIC 0x00000000
#define RESOURCEDISPLAYTYPE_DOMAIN 0x00000001
#define RESOURCEDISPLAYTYPE_SERVER 0x00000002
#define RESOURCEDISPLAYTYPE_SHARE 0x00000003
#define RESOURCEDISPLAYTYPE_FILE 0x00000004
#define RESOURCEDISPLAYTYPE_GROUP 0x00000005
#if(WINVER >= 0x0400)
#define RESOURCEDISPLAYTYPE_NETWORK 0x00000006
#define RESOURCEDISPLAYTYPE_ROOT 0x00000007
#define RESOURCEDISPLAYTYPE_SHAREADMIN 0x00000008
#define RESOURCEDISPLAYTYPE_DIRECTORY 0x00000009
#endif /* WINVER >= 0x0400 */
#define RESOURCEDISPLAYTYPE_TREE 0x0000000A
#if(WINVER >= 0x0400)
#define RESOURCEDISPLAYTYPE_NDSCONTAINER 0x0000000B
#endif /* WINVER >= 0x0400 */
My guess is that a container is: ROOT, NETWORK, SHAREADMIN, NDSCONTAINER, GROUP, DOMAIN, SERVER, maybe TREE
But absolutely not sure!
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Thanks again.
But if I do not know the typies of "container", how can I know whether a "NETRESOURCE" is a container that contain sub-"NETRESOURCE"?
From which flag can I know?
Best regards.
Maer
|
|
|
|
|
The RESOURCEUSAGE_CONTAINER does this, but to know if it actually contains something you have to call WNetOpenEnum().
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi,Paolo.
Thanks again.
In your reply, you said "The RESOURCEUSAGE_CONTAINER does this", but how about the value of "dwScope" at the same time?
(I mean should I test the whether the value is "RESOURCE_GLOBALNET & RESOURCEUSAGE_CONTAINER" or "RESOURCEUSAGE_CONTAINER"?)
Should the value of "dwScope" be "RESOURCE_GLOBALNET"?
Hope you can help.
Best regards.
Maer
|
|
|
|
|
You may safely ignore the dwScope flags.
Only check if (dwUsage & RESOURCEUSAGE_CONTAINER) is non-zero.
This is what I did in the article's demo prject, and it works
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi, Paolo.
You method works perfectly. But it can not emun the shared folders and shared files?
How to resolve the problem?
Maer
|
|
|
|
|
Yes, I know that. You can see also in my demo project that the last item in the tree structure is a shared folder.
You have to take the path of the shared folder and continue enumeration using FindFirstFile/FindNextFile (appending a "\*.*" or whatever mask you want to the path).
Enumeration of local files/folders (even if shared) is not responsibility of the WNet APIs, but you have another way.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I have an ini file that I use to hold system settings.
I do not want the user to be able to open it and change values.
Can an ini file be encripted and still read and written using
GetPrivateProfileString and
WritePrivateProfileString
thank you.
|
|
|
|
|
You can't encrypt the entire file and still have it work with Get/WritePrivateProfileString, but you *can* encrypt the data before saving it to the INI file, and decrypt it after reading. However, if one of the encrypted strings contains a semi-colon, you may not get all your data back because that character represents the start of a comment in the file.
I would use a binary data file and encrypt/decrypt the data into/from there, or use the registry.
|
|
|
|
|
Have you ever heard about Multiple File Streams feature supported by NTFS file system?
If not, I recommended you to read technical article from on MSDN from Dino Esposito:
"A Programmer's Perspective on NTFS 2000 Part 1: Stream and Hard Link"
It can give you one idea how to easilly do it without file encryption
Martin
--->
|
|
|
|
|
How to initialize the follow parameter in "NETRESOURCE"?
( I ues the structure for the next call to "WNetOpenEnum")
LPTSTR lpLocalName
LPTSTR lpRemoteName
LPTSTR lpComment
LPTSTR lpProvider
Can you show me an example in practice?
Thanks.
Maer
|
|
|
|
|
I think you only need lpRemoteName and some flags.
You may also consider to use the shell and SHGetDataFromIDList if you have a PIDL of the net resource. You may obtain that by parsing a network path with SHGetDesktopFolder and IShellFolder::ParseDisplayName.
But it's surely easier to try with the first method
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi, my pal.
Thanks for your reply.
I have read the information about SHGetDesktopFolder, IShellFolder::ParseDisplayName, SHGetDataFromIDList in MSDN.
Can you show me a sample code using the functions you mentioned before to get the first level of "NETRESOURCE" of the "Network Neighborhood"?
Thanks again.
Best regards.
Maer
|
|
|
|
|
(the follow is from MSDN)
BOOL WINAPI EnumerateFunc(HWND hwnd,
HDC hdc,
LPNETRESOURCE lpnr);
What is the function "WINAPI" here?
Thanks.
Maer
|
|
|
|
|
WINAPI specifies the calling convention of the function. The calling convention is the set of rules followed to pass arguments to and invoke a function. Some aspects a calling convention must define are- Whether parameters are stored in registers or in the stack,
- the order in which parameters are stored in the stack (first parameter the first to be pushed or the other way round),
- whose responsibility it is to clean the stack after return,
- how the return parameter is passed from the function to the invoker.
So, different languages typically specify different calling conventions (notably, the Pascal calling convention is that the callee clean the stack before returning, whereas in C it is the caller that does the job). If a function is invoked with a different calling convention than expected, crash is almost sure to happen.
The language C (as implemented by Microsoft) allows the specification of the calling convention of a function so that you can invoke it even if it does not follow the C calling convention. Some calling conventions are:__cdecl , the C default calling convention,
__stdcall , aka PASCAL ,
__fastcall , __thiscall , etc.
WINAPI is simply a macro for __stdcall , and ensures that your program calls Windows APIs the Pascal way.
Why do Win32 APIs use the Pascal calling convention instead of __cdecl ? Remember that these functions inhabit global DLLs of the system and are invoked by different programs written in different languages, so they just had to stick to some particular convention.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks pal.
I still have a question.
In __stdcall calling convention, the callee cleans the stack, so it can not be a vararg function.
In __cdecl calling convention, the calling function cleans the stack, so it can be a vararg function.
I do not understand "the calling function cleans the stack, so it can be a vararg function" and "the callee cleans the stack, so it can not be a vararg function".
Can you explain the mechanism of stack cleaning and vararg function?
Thanks.
Maer
|
|
|
|
|
Michael Dunn already answered
|
|
|
|
|
Thanks all the same.
Best regards.
Maer
|
|
|
|
|
Hello,
Can some one suggest a Data compression algorithm and if possible a link to the algorithm. Mainly my data types are either text or bitmap. Thanks for the time.
Ganesh.M.Ramaswamy
|
|
|
|
|
www.zlib.org
zLib is pretty much the public domain standard in data compression. it's fast, well tested, does a good job (equivalent to ZIPping the data file) and, it's free!
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
What's wrong with the convertion?:
CComVariant varStrRet(ostrBuffer.str().c_str());
ostrBuffer is ostringstream. Everithing works fine but if I load more then aprox. 500Kb into ostrBuffer the the convertion result in access violetion. Enyone knows why?
Thanks a lot for any help
Peter
|
|
|
|
|
I would like to know how to create an ActiveX control from an existing Windows Control
|
|
|
|