Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,082 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,792 people online right now. Registration is fast and FREE... Join Now!




System32 Path

 
Reply to this topicStart new topic

System32 Path

yogesh sharma
21 Jun, 2008 - 11:23 PM
Post #1

New D.I.C Head
*

Joined: 21 Jun, 2008
Posts: 11

hey frnds, I know the foll one line code which is shown below--
that returns the System32 Path .

?environment.GetFolderPath (Environment.SpecialFolder.System )
"D:\WINDOWS\system32"

But i want the Function that Returns the above code.

Did Somebody knows that??????
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: System32 Path
22 Jun, 2008 - 06:27 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

yogesh sharma
RE: System32 Path
22 Jun, 2008 - 07:25 AM
Post #3

New D.I.C Head
*

Joined: 21 Jun, 2008
Posts: 11

Sir I already write my code as above....
User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: System32 Path
22 Jun, 2008 - 07:59 AM
Post #4

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,262



Thanked: 39 times
Dream Kudos: 1675
My Contributions
If your just having trouble getting the path to the system32 folder, this should do it:
vb

System.Environment.ExpandEnvironmentVariables("%windir%\system32")

User is offlineProfile CardPM
+Quote Post

born2c0de
RE: System32 Path
25 Jun, 2008 - 06:56 AM
Post #5

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,032



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
If you're looking for the internal code that retrieves the System Path, you will need to disassemble the mscorlib Library File using ILDASM or Reflector to see the code.

This is a dump from Reflector:
vb
Public Shared Function GetFolderPath(ByVal folder As SpecialFolder) As String
If Not Enum.IsDefined(GetType(SpecialFolder), folder) Then
Throw New ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_EnumIllegalVal"), New Object() { CInt(folder) }))
End If
Dim lpszPath As New StringBuilder(260)
Win32Native.SHGetFolderPath(IntPtr.Zero, CInt(folder), IntPtr.Zero, 0, lpszPath)
Dim path As String = lpszPath.ToString
New FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand
Return path
End Function

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:35PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month