Windower: Finding Windower Directory with .NET - Windower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Finding Windower Directory with .NET Use resources XML files in your applications

#1 User is offline   Aikar 

  • delete world; world = new Planet("Code");
  • PipPipPipPipPipPipPipPipPipPip
  • Group: +Retired Windower Members
  • Posts: 4045
  • Joined: 19-April 05
  • Gender:Male
  • Location:Raleigh, NC
  • Interests:PHP, FFXI, C++
  • Name: Aikar, Aikari
  • Server: Leviathan
  • Jobs: WHM75 BLM75
  • Race: Tarutaru Male
  • Linkshell: Eternia

Posted 30 March 2009 - 01:57 PM

Here is some code that will automatically find the Windower directory without prompting your users to specify it!
Now you can make use of windowers resources files in your applications without a sweat.

VB.NET
   Public Function FindWindower() As String
		Dim Processes As Array
		Processes = System.Diagnostics.Process.GetProcessesByName("pol")
		If Processes.Length > 0 Then
			Dim i As Integer
			Dim Mods As ProcessModuleCollection
			Mods = Processes(0).Modules()
			For i = 0 To Mods.Count() - 1
				If Mods(i).ModuleName.ToLower = "hook.dll" Then
					FindWindower = Mods(i).FileName.Substring(0, InStr(Mods(i).FileName.ToLower, "hook.dll") - 1)
					Exit Function
				End If
			Next
		End If
		FindWindower = ""
	End Function


It should be very easy to change that to C# if thats what your using since its all the same .net stuff, just change the variables and function declaration etc.
If anyone wants to switch it over to C# paste it and ill add it to post.

NOTE: your app must be built in x86 and not 'Any CPU' as when ran on 64bit systems itll only return 64bit modules if done on Any CPU
- RETIRED - I am no longer working on the Windower project and have retired from MMO's entirely to work on my personal RL goals and creating my own MMO game, follow up on what im doing @ Aikar.co
- FFOChat - Join the FFXI Community!
0

#2 User is offline   Tavik 

  • Advanced Member
  • PipPipPipPip
  • Group: Members
  • Posts: 215
  • Joined: 10-February 06
  • Gender:Male
  • Server: Quetzalcoatl
  • Race: Mithra

Posted 01 April 2009 - 08:20 PM

For all you C# programmers out there... this should do the trick.

		public string FindWindower()
		{
			string WindowerPath = "hook.dll not found";
			Process[] Processes = Process.GetProcessesByName("pol");
			if (Processes.Length > 0)
			{
				foreach (ProcessModule mod in Processes[0].Modules)
				{
					if (mod.ModuleName.ToLower() == "hook.dll")
					{
						WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8);
						break;
					}
				}
			}
			return WindowerPath;
		}

0

#3 User is offline   Roket84 

  • Trainee
  • Pip
  • Group: Members
  • Posts: 24
  • Joined: 29-May 07
  • Gender:Male
  • Location:Tennessee, United States
  • Name: Cyte
  • Server: Hades
  • Jobs: RDM RNG BLM
  • Race: Hume Male
  • Linkshell: BahamutsRejects

Posted 30 May 2009 - 10:39 PM

To be complete here is the code for this function in Boo. ^^
public def FindWindower() as string:
	WindowerPath = 'hook.dll not found'
	Processes as (Process) = Process.GetProcessesByName('pol')
	if Processes.Length > 0:
		for mod as ProcessModule in Processes[0].Modules:
			if mod.ModuleName.ToLower() == 'hook.dll':
				WindowerPath = mod.FileName.Substring(0, (mod.FileName.Length - 8))
				break 
	return WindowerPath

Posted Image
-=Projects=-
  • DK WinTweak
  • Ganadia MUD
  • Cowboy Bebop - Space Cowboy MUD
  • Xtreme-G Tweakerizer

-=Current Projects=-
0

#4 User is offline   Fawe 

  • New Member
  • Group: Members
  • Posts: 7
  • Joined: 04-July 11
  • Name: Vicrelant
  • Server: Carbuncle
  • Jobs: THF/DNC
  • Race: Tarutaru Male
  • Linkshell: RavenFamily

Posted 31 May 2012 - 09:33 AM

View PostTavik, on 01 April 2009 - 08:20 PM, said:

For all you C# programmers out there... this should do the trick.

		public string FindWindower()
		{
			string WindowerPath = "hook.dll not found";
			Process[] Processes = Process.GetProcessesByName("pol");
			if (Processes.Length > 0)
			{
				foreach (ProcessModule mod in Processes[0].Modules)
				{
					if (mod.ModuleName.ToLower() == "hook.dll")
					{
						WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8);
						break;
					}
				}
			}
			return WindowerPath;
		}




I had tested this and never came back with the module for pol, is there a different between x64 and x32 systems when doing this cause when I check the Modules under POL all i get is this:

ntdll.dll
wow64.dll
wow64win.dll
wow64cpu.dll

I tested this under 2 systems I have and same result any suggestions? I am also using this to attempt to find FFXIMain.DLL but with no luck same result above with the modules and seeking some help and yes this would be solely for C#.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users