Is there another method from Win32 that I could use that doesn't require
administrator privilege?
NetShareGetInfo requires privileges when asking for level 2 or higher
details. Level 2 and above are the only levels that wil tell you the local
path.
Is there an alternative? Thanks,

Signature
Brian R.
> Hi Brian,
>
[quoted text clipped - 42 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 26 Jun 2007 07:06 GMT
Hi Brian,
Thank you for the feedback.
Yes, I can reproduce this behavior. It seems that NetShareGetInfo requires
Administrator right to call for SHARE_INFO_2. I have tried to contact the
NetShareGetInfo API owner team to confirm if this is by design and if there
is any other way to workaround this Administrator right requirement. If
this is by design, I do not think there is any other way to query this
without Administrator right, because if the other way existed, it will
become a security hole of this design.
Anyway, I will get back to you ASAP. Thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 26 Jun 2007 10:48 GMT
Hi Brian,
Sorry for letting you wait.
I have discussed this issue with the dev team.
Per MSDN (http://msdn2.microsoft.com/en-us/library/aa380482.aspx)
"Only members of the Administrators, Server Operators, or Power Users local
group, or those with Print or Server Operator group membership, can
successfully execute the NetShareGetInfo function at level 2. No special
group membership is required for level 0 or level 1 calls."
In Vista, non-admins are able to query at level 2 for local shares, but not
against remote machines. For remote machines, you either need Power
User/Admin/server Operator group permissions (the latter group I believe is
deprecated, and Power Users may also be in Vista).
If your infrastructure wanted to allow the normal user to access remotely,
you could write an agent to gather share information locally and send it to
the server.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Brian R. - 26 Jun 2007 14:49 GMT
I had read that in the documentation and was looking for an alternative. We
are not running our app on Vista yet, so I cannot count on being able to
call version 2.
All I am interested in translating are local shares. I looked at the File
and FileInfo objects to see if they offered an operator== that would let you
know if they were the same, but I didn't see one.
Is there a way to see if they are the same that I might have missed. It is
expected that my application user will have access to these files.

Signature
Brian R.
> Hi Brian,
>
[quoted text clipped - 40 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 27 Jun 2007 08:41 GMT
Hi Brian,
Thank you for the feedback.
I do not think File/FileInfo == operator is useful here. This operator will
only check if 2 objects are equal. It can not know if these 2 file objects
pointed to the same local file/directory. You should use FileInfo.FullName
property to compare their absolute full path.
The only problem left is the UNC share folder path, which is different from
the local NTFS path. We have 2 solutions in this scenario:
1. Embed admin username/password in the application, so that you can
impersonate the Administrator and call NetShareGetInfo
2. Writing an agent application which runs under Administrator account.
This agent application can call NetShareGetInfo to retrieve the local
absolute path and pass it to your non-admin application for comparison.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.