[HELP]Visual Basic

Posts 1–10 of 10 · Page 1 of 1
[HELP]Visual Basic
1st Question Sir how can i make an application that auto choose a dll..?

Example : I make an injector and i want to make that injector to choose a dll in auto.. how can i make that ? Help me please... so the one that will use the injector will not know where the dll is..

2nd question Sir

I would like to know how i can get the location of c:\windows\system32 because some pc install windows not at C: drive

Thanks in Advace !!
Answer to Question 1

Have dll in the same path as application (as in the same folder)
then set to inject dll from application path using

Code:
Application.StartupPath
or

Code:
Application.Executablepath
@ Question 2

You can get the system folder using

Code:
Environment.GetFolderPath(Environment.SpecialFolder.System)
A example of use would be

Code:
MsgBox(Environment.GetFolderPath(Environment.SpecialFolder.System))
Test this on Form1_Load and you should get a message box listing the system32 folder path, you can use this method to return the system32 folder.



1. Locate current folder via. Application.StartupPath (environment.currentdirectory can change)
2. Enumerate all (or one) DLL file(s) in that folder using Directory.GetFiles
3. Inject!

EDIT: The below is incorrect. Thanks NextGen1 for pointing that out! See further details here.
For your second question C:\ is ALWAYS the active Windows drive path - C:\WINDOWS\system32 will always be located at that position.
Quote Originally Posted by freedompeace View Post
For your second question C:\ is ALWAYS the active Windows drive path - C:\WINDOWS\system32 will always be located at that position.
Wait what ? If I install windows on D Drive, then wouldn't it be:

D:\Windows\System32\

?
@ Freedom,

A. It's already answered
B. C is always the active windows path (yes hassan even if installed on D:\ drive, The OS will make the Active Windows Drive the C Drive.) However, the system folder location may be different.

Example, On a dual partition (or on newer OS) system paths may be different, Example: My Current System folder for this OS is C:\Windows.0\System32

My Second OS is C:\Windows\System32

and My 3rd is C:\Windows.1\System32 This happens when multiple windows OS's are installed on one partition and is not at all uncommon, so my solution is correct, your solution could exclude maybe 40% of consumers and is based on a assumption, that is why there is a need and a reason for special directory codes my friend, if everything (including special directories) were static, there would be no need for the code. ...............!... .


So with that said, If you use

Code:
Environment.GetFolderPath(Environment.SpecialFolder.System)
to return the current windows system32 folder you can then use it anyway you need too.




Oh ok. My bad, didn't knew that. Sorryz freedom :P
he was still wrong about the system folder, failed installs or multiple installs will change the relative path of the system32 folder, almost the same way that upgrading new windows OS's change the older windows to .old (almost the same way)

Anyway, hence the reason for special directories in the .net framework, again, if everything was static, there would be no need for them.....

Quote Originally Posted by NextGen1 View Post
he was still wrong about the system folder, failed installs or multiple installs will change the relative path of the system32 folder, almost the same way that upgrading new windows OS's change the older windows to .old (almost the same way)
Yup, he is partially right. There wouldn't be any point of system variables then !!
as expressed before , he is right that c:\ will always be the active windows directory, but he made the point to declare that system32 will (and i quote) "C:\WINDOWS\system32 will always" be at that path, which is 100% incorrect, therefor the windows active directory as C:\ becomes moot as that was the basis of his argument.

but enough said.
Quote Originally Posted by NextGen1 View Post
@ Freedom,

A. It's already answered :p
B. C is always the active windows path (yes hassan even if installed on D:\ drive, The OS will make the Active Windows Drive the C Drive.) However, the system folder location may be different.

Example, On a dual partition (or on newer OS) system paths may be different, Example: My Current System folder for this OS is C:\Windows.0\System32

My Second OS is C:\Windows\System32

and My 3rd is C:\Windows.1\System32 This happens when multiple windows OS's are installed on one partition and is not at all uncommon, so my solution is correct, your solution could exclude maybe 40% of consumers and is based on a assumption, that is why there is a need and a reason for special directory codes my friend, if everything (including special directories) were static, there would be no need for the code. ...............!... .
Oh dayum you're right!

I've edited my post accordingly :)
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?