Home

GetModuleFileName

[신카이 마코토] 언어의 정원

_GetModuleFileName function - Win32 apps Microsoft Doc

GetModuleFileName () takes 3 arguments: 1.) A handle to a module (Just use NULL to retrieve the current prog's path) 2.) A pointer to a char [] buffer. 3.) The size of the buffer. And it returns the number of characters that were copied to the buffer. So to use it you would write something like this GetModuleFileName is returning the working directory, not the EXE directory. The documentation says it should return the Module directory, which I believe should be the EXE or DLL directory. When I debut with VS2012 it provide the EXE directory, which is also the working directory. When I · The whole part of code that deals with GetModuleFileName. @Vipin GetModuleFileName works correctly. The problem is either in your expectation, or your code. If you won't show your code then you'll have to solve the problem by yourself. I suggest that you read this answer again, more carefully. Note how the code calls GetModuleFileName and obtains the path of th Description. Returns the fully qualified name for a module, given its handle. Call GetModuleFileName to obtain the fully qualified name of a module, given its handle. On Windows, use the Windows API with the same name instead. Module is the handle of the module whose file name is required.. Buffer is a buffer that receives the file name.. BufLen is the number of bytes in Buffer

Viewed 1k times. 0. I am trying to get the current executable path into a string by using this code (I have tried several other versions of it too, but none of them really works, I always get a access violation at some point) char *filename = new char [MAX_PATH + 1]; GetModuleFileName (NULL, filename, MAX_PATH); string exe = filename; This. Re: GetModuleFileName - Linux Equivalen. As jamie wrote for the path of the main binary you can use TApplication.Filename or TApplication.Location or if you don't use a GUI you can use ParamStr (0). Alternatively you can (at least no Linux) check what file the symbolic link /proc/self/exe is pointing to Tips & Tricks: If you want to use GetModuleFilename to retrieve the path the current executable was started from, you should instead consider using System.Windows.Forms.Application.StartupPath. This is a wrapper around GetModuleFilename, so it probably does exactly what you want. Another way: Process.GetCurrentProcess ().MainModule.FileName

Hi, I used the GetModuleFilename in another project, so I copied my code over. Unfortunately it is not working. This project is using visual studio expresss 2005. int initialize() { // With standard string Extract directory char szAppPath[MAX_PATH] = ; char szAppDirectory[MAX_PATH · The downside is that it is a bit harder to deal with Unicode. The libloaderapi.h header defines GetModuleHandle as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors GetModuleFileName () in linux. On Linux, the pathname at the time of exec is put at the fixed end. of the stack. On many common Linux x86 distributions where the stack ends. at 0xc0000000, the 32-bits at 0xbffffffc is 0, and the '\0' which terminates. the pathname at time of exec is at 0xbffffffb C++ (Cpp) GetModuleFileNameW - 30 examples found. These are the top rated real world C++ (Cpp) examples of GetModuleFileNameW extracted from open source projects. You can rate examples to help us improve the quality of examples. void MyAssertDumpToFile(const wchar_t* pszFile, int nLine, const wchar_t* pszTest) { wchar_t dmpfile [ MAX_PATH +64.

c++ - How to properly use GetModuleFileName? - Stack Overflo

  1. Solution 1. Accept Solution Reject Solution. The GetModulePathName [ ^] documentation mentions. Copy Code. The string returned will use the same format that was specified when the module was loaded. What you're getting is the short path name [ ^] Use GetLongPathName [ ^] to convert the returned path into it's long path form. Permalink
  2. Petteri> name as GetModuleFileName does in Windows? Actually I Petteri> could do with only path of the library. My library will Petteri> be loaded as dynamic library with dlopen(). I suggest to use the dladdr call of the libld library. The dladdr call is not as portable as dlsym (it might be Linux specific, or at least not in latest Posix spec)
  3. The latest. road block is that GetModuleFileName (NULL, buffer, 512) doesn't seem to work. in Windows 64-bit. The tanuki code calls it on initialization and bombs out if it doesn't like. what it sees. In the debugger, we see that GetModuleFileName () returns. simply c, not a real path to anything. There's another issue in that Visual Studio.
  4. API Description : The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module. VB Declaration : Show Multiline Public Private. Declare Function GetModuleFileName Lib kernel32 Alias GetModuleFileNameA (ByVaL hModule As Long, ByVaL lpFileName As String, ByVaL nSize As Long) As.
  5. The approach you are using is the directory where the executable file for the current process is located. If this is the directory you want, then after you have got the full module path using GetModuleFileName you can then use either: 4. PathRemoveFileSpec from the Path API
  6. View license def _find_w9xpopen(self): Find and return absolut path to w9xpopen.exe w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), w9xpopen.exe) if not os.path.exists(w9xpopen): # Eeek - file-not-found - possibly an embedding # situation - see if we can locate it in sys.exec_prefix w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix), w9xpopen.exe) if not os.path.

業務でGetModuleFileName関数は、実行ファイルと同じディレクトリに置かれたiniファイルのファイルパス名を取得するのに使用されていました。 GetModuleFileName関数で取得したファイルパス名には、実行ファイル名も含まれます。 そのため前回紹介し Replace GetModuleFileName with GetBinaryLocation (fix #2297) #3221 Merged chakrabot merged 1 commit into microsoft : master from unknown repository Nov 16, 201 Find the path of dll from GetModuleFileName in vc++. Access to the path is denied. C# - file path using open with... How to Get the Original file path using javascript in file upload. Determine the path or a process on WOW64 / use of GetProcessImageFileName The GetModuleFileName function does not retrieve the path for modules that were loaded using the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx. lpFilename [out] A pointer to a buffer that receives the fully qualified path of the module. If the length of the path is less than the size that the nSize parameter specifies. C++ CLI/CLR - Get Module File Name and Path. Get full path & name of current process: GetModuleFullName. Get path of current process (directory name) by removing last element in a path string: PathCchRemoveFileSpec / PathCchRemoveFileSpecW (Unicode). // For GetModuleFileName. #include <Windows.h>

I recommended him to try GetModuleFileName() but I'm affraid it'll return the original name of the DLL. Using GetModuleHandle() to find if module was loaded before can't be used because it is allowed case; process can already have new DLL loaded or no executed points #2 and #3. We'd just need a way how to find current name of loaded DLL after. Re: getModuleFileName. You need to use wcout rather than cout for path as path is wide-char. Code: #include <Windows.h> #include <iostream> using namespace std; int main () { WCHAR path [500]; DWORD size = GetModuleFileNameW (NULL, path, 500); wcout << this is the name of the path << path; cout << endl << this is the size of the name of the. I rebuild my win32 project (create dll) to support windows store App by VS2012. I set project's property->Configuration Properties->General->Windows Store App Support is Yes , then I found Windows API GetModuleFileName can not be used in windows store style . Which Windows store API can · Hi H, There is no WinRT equivalent for this API. -Jeff. lResult = GetModuleFileName (lHandle, sBuffer, MAX_PATH) lblPath.Caption = sBuffer. When you run the sample program, it will return the path where you have. Visual Basic installed since that is the executable currently running the. code. Once you compile the program and run it you will see the correct. results. Dave

GetModuleFileNameExA function (psapi

Is there a portable way to do the equivalent of GetModuleFileName(0) in Linux? I was working on a game with some friends over the Spring. Now, I'm porting it to Linux, but I've run into a snag. I need to be able to find the directory where the executable is actually located, which I can acco GetModuleFileName (WinAPI) equivalent implementation for OSX - GetModuleFileName.cp Because I can't trust Windows I want to use GetModuleFileName safely = If the module is longer than MAX_PATH truncate it and add a NULL at the end. PLEASE HELP!!! Last edited by Salvadoravi; July 22nd, 2008 at 12:04 PM GetModuleFileName() 获取当前进程已加载模块的文件的完整路径,该模块必须由当前进程加载。如果想要获取另一个已加载模块的文件路径,可以使用GetModuleFileNameEx函数。函数原型: DWORD WINAPI GetModuleFileName( _In_opt_ HMODULE hModule, //应用程序或DLL模块实例句柄,NULL则为获 GetModuleFileName() & boost::filesystem sample. GitHub Gist: instantly share code, notes, and snippets

If you call GetModuleFileName(NULL,) from within a DLL, you will get the path and filename of the top-level EXE file that ultimately loaded your DLL, *not* the filename of the DLL itself. One way to do get the module handle is to either (1) add your own DllMain() implementation or (2) modify the existing one to save the module handle as a global variable Looking for .NET equivalent of GetModuleFileName. Tom, I followed you advice, I got the module alright. However it shows the dll name not the main executable name. Any suggestion to get the exe name. BTW, the code that execute GetCaller is inside a C# library project. -Dan . Quote Get application's full path, MFC, using AfxGetApp()->m_pszExeName, GetModuleHandle and GetModuleFileName / Published in: C++. Save to your folder(s) For C++ MFC applications, this code gets the full path of the application (even if the application is a DLL run with RunDll32) compmod\microsoft\win32\SystemEvents.cs (1) 1255UnsafeNativeMethods.GetModuleFileName(NativeMethods.NullHandleRef, sb, sb.Capacity);(NativeMethods.NullHandleRef, sb.

C++ (Cpp) GetModuleFileName Examples - HotExample

Solution 2. Accept Solution Reject Solution. From GetModuleFileName () [ ^] in the MSDN: Quote: The string returned will use the same format that was specified when the module was loaded. Therefore, the path can be a long or short file name, and can use the prefix \\?\. So it should be like on your disk when double clicking the file in the. The icons for MS-Windows applications are included in the program's resource, which is part of the *.exe and it can be anything the developer chooses it to be GetModuleFileName may return incorrect results for win32-apps running under wow64. If you have a win32-app that is running under an x64/IA64 OS (like Windows 2003 Server x64 Edition), then your app is running under Wow64. In Wow64, all file-access to C:\windows\system32 is redirected to C:\windows\SysWow64

GetModuleFileName ( NULL, szEXEPath, 204 - C++ Foru

Facebook Hacker 2015

After GetModuleFileName() is called, the buffer szFileName will be filled with a null terminated string containing the name of our .exe file. We pass this value to MessageBox() as an easy way of displaying it to the user. So if you've added in that code, compile it now. If it works, click on the window and you should see a box with the name of. Hi, Does anyone know why my project is using the GetModuleFileNameW definition instead of GetModuleFileName although I don't have a UNICODE preprocessor definition??? Thanks in advance! · You probably have on your Project Properties > Configuration Properties > Character Set > Use Unicode Character Set · If you're creating a unicode only application. getModuleFileName. 2. GetModuleFileName() ? 3. GetModuleFileName with Process. 4. Question about GetModuleFileName function. 5. GetModuleFilename and ShellExecute woes. 6. GetModuleFileName for any Process. 7. How do I always get LONG file names with GetModuleFileName

GetModuleFileName does not seem to function properl

GetModuleFileName () in Linux. manlore asked on 1/11/2000. C++. 7 Comments 1 Solution 5089 Views Last Modified: 3/6/2008. I need a way to get the complete path/filename of a executable into them (Running on Linux). Similar to Windows GetModuleFileName (). NOTE: The complete path/filename where the executable file are How GetModuleFileName used in ChakraCore, we don't need the return value. The replacement function is designed this in mind and already takes care of other cases. If you want to help us on making GetModuleFileName usage right, I would like to have a chat with you on gitter about #2297 GetModuleFileName example. GetModuleFileName function is used to give the fully qualified path of the module passed. hModule: Handle to the loaded module. If you pass NULL as the first argument , it gives us the path of the executable file of the current file. lpFileName: Pointer to the buffer where the fully qualified path will be stored jonwis mentioned this issue on Dec 29, 2020. GetModuleFileName [Ex]W is confusing #169. Merged. jonwis closed this in #169 on Dec 31. jonwis added a commit that referenced this issue on Dec 31. Re- resolves #163 ( #169) Verified. This commit was created on GitHub.com and signed with GitHub's verified signature GetModuleFileName [HELP] I am trying to get the HWND of a Activated Application and to get its Application path with few API's.. Everything is working fine, these codes can Get the Caption of any Activated Window, Can get HWND also, but not getting Application path. Here GetAppFilename function is not working

c++ - GetModuleFileName() not giving the correct path of

The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module.. DWORD WINAPI GetModuleFileName( __in HMODULE hModule, __out LPTSTR lpFilename, __in DWORD nSize ); hModule. A handle to the loaded module whose path is being requested METHOD 3: GET FROM THE COMMAND LINE. Note: If the installer is executed using the console, the command line might not contain the current folder or the .exe extension To create a page in a module other than coredll, prefix the name with the module name and a period. GetModuleFileName (coredll) coredll is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for GetModuleFileName in other DLLs exists, click on Find.

GetModuleFileName in C++ (vc++) Compilation time: 2,68 sec, absolute running time: 0,33 sec, absolute service time: 3,02 se Re: 3.0.2 VS2013 GetModuleFileName not found Post by doublemax » Wed Mar 04, 2015 4:50 pm Changing the order of includes is going to be difficult because POCO is part of the non-GUI part of my app that all other dlls depend on

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another a small question about GetModuleFileName 26-Feb-02 0:03 what is the adventage of using GetModuleFileName(AfxGetInstanceHandle(), FileName, MAX_PATH) instead of GetModuleFileName(NULL, FileName, MAX_PATH) Microsof The getcwd () is an inbuilt function, which is used to access the current directory. Basically we pass an array to this function and this function places an absolute pathname of the current directory in that array. One can use get_current_dir_name () or getwd () instead of getcwd (). All these functions are available in the header <unistd> Smith's C++ Virus Writing Guide - posted in Tutorials: Smith Guide to simple C++ VirusesOk first off I'd like to say 2 things:1. This guide is only intended for people who want to learn2. I don't condone releasing viruses in any wayTaking the above into consideration I'd like to say welcome to the world of virus programming I'm hoping upon reading this you well become as fascinated by.

System.GetModuleFileName - RAD Studio API Documentatio

Unit: Get/Set PEB - GetModuleFileName. Author: steve10120. Description: Get and/or set the PEB filename value. Credits: Karcrack. Website: hackhound.org. } When injected into another process, retreive the correct GetModuleFileName as opposed to the process you are injected to. function AltGetPEBModuleFileName ():WideString; var The GetModuleFileName(hModule, pFileName, nSz) returns NULL if hModule refers to console app (and probably 16bit app too). There's absolutely no way around it as I need to get file path from the window handle. Not sure what you mean. Calling GetModuleFileName() from a console app works fine if you pass NULL as the hModule (it will take the.

Automating DLL Hijack Discovery

Analog for GetModuleFileName() Windows API. noxidog asked on 12/26/2002. Linux OS Dev. 2 Comments 1 Solution 1125 Views Last Modified: 12/19/2007. I am trying to come up with an analog for the Windows API GetModuleFileName(). Here is my code: inline DWORD GetModuleFileName(void* hModule, LPTSTR buff, DWORD nSize get exe filename using GetModuleFileName(). GitHub Gist: instantly share code, notes, and snippets DWORD GetModuleFileName (. HMODULE hModule, LPTSTR lpFilename, DWORD nSize. ); 获得hModule所指的文件的名字,. hModule在LoadLibrary之类的函数会返回,是一个句柄,用来标记这个文件资源。. lpFilename是你存放返回的名字的内存块的 指针 ,是一个输出参数,nSize是这个内存块的大小. 1) when I left click the mouse, Notepad opens a file named Unicode.txt (located in the default data directory). If this file don't exist it is created (with the BOM). 2) The XControl monitor the modification of this file. When we save this file, the XControl is automatically updated GetModuleFilename (NULL,Path,MAX_PATH); PathRenameExtension (Path,.txt); (Don't forget the L prefix ( L.txt ) if you are working with UNICODE enabled. It's used quite a bit for help files with extensions .hlp or .chm. It's also used for initiliazation files with the .ini extension

visual c++ - C++ GetModuleFileName Access Violation

Re: GetWindowModuleFileName, GetModuleFileName, GetModuleNameEx, help needed. try to use the GetWindowThreadProcessId func in conjunction with the ToolHelper functions, which under win95, are the Process32First etc. functions. through the processid you will be able to get the modulename. Quick Navigation Visual C++ Programming Top 1,628. Found here : To get the application path you have to use 'GetModuleFileName ()'. It will return the complete path and the applications' name. The function 'GetCurrentDirectory ()' only returns the applications' working directory which may be different from the applications' directory and also may be changed at runtime GetModuleFileName. The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module. Windows 95: The GetModuleFilename function will return long filenames when an application's version number is greater than or equal to 4.00 and the long filename is available 3.1. extern C C++ has a special keyword to declare a function with C bindings: extern C.A function declared as extern C uses the function name as symbol name, just as a C function. For that reason, only non-member functions can be declared as extern C, and they cannot be overloaded.. Although there are severe limitations, extern C functions are very useful because they can be.

GetModuleFileName - Linux Equivale

NetworkCap.exe file information. The process known as HP Network HSA Service belongs to software NetworkCap by HP (www.hp.com).. Description: NetworkCap.exe is not essential for the Windows OS and causes relatively few problems. The file NetworkCap.exe is located in a subfolder of C:\Windows\System32 (in most cases C:\Windows\System32\DriverStore\FileRepository\hpcustomcapcomp.inf_amd64. The principle of all the filesystem detection methods is the following: there are no such files and directories in usual host; however they exist in particular virtual environments and sandboxes. Virtual environment may be detected if such an artifact is present. 1. Check if specific files exist. This method uses the difference in files which. Ryuk has been one of the most proficient ransomware gangs in the past few years, with the FBI claiming $61 million USD having been paid to the group as of February 2020. Earlier in the year, the group grew a little quiet, but that seems to have changed in the past few weeks, with incidents like what occurred at UHS hospitals

pinvoke.net: getmodulefilename (kernel32

Steps to perform SFC scan: 1. Click the Start button. 2. From the Start Menu, Click All programs followed by Accessories. 3. In the Accessories menu, Right Click on the Command Prompt option. 4. From the drop down menu that appears, Click on the 'Run as administrator' option GetModuleFileName The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module. Windows 95: The GetModuleFilename function will return long filenames when an application's version number is greater than or equal to 4.00 and the long filename is available GetModuleFileNameのプロトタイプ DWORD GetModuleFileName( HMODULE hModule, // モジュールのハンドル LPTSTR lpFilename, // モジュールのファイル名 DWORD nSize // バッファのサイズ );第一引数のhModuleにNULLを指定すると、現在実行中の実行ファイルのフルパスを取得することができる

Returns a newly constructed string object with its value initialized to a copy of a substring of this object. The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first). Parameters pos Position of the first character to be copied as a substring 点这里看中文版. This post was written by Gabriel Dos Reis, Andrew Pardoe, and Billy O'Neal . What Is New? The Visual C++ Team is elated to announce that with Visual Studio 2017, it has substantially improved the quality of the C++ Modules TS implementation in Visual Studio, in addition to introducing ability to consume the C++ Standard Library via module interfaces Sample VBScript Programs . Getting started: Input string from a user and echo back: simple.vbs Simple html file: simplehtml.html Get 3 numbers from a user and find the largest: largestNum.vbs Put largestNum program in an html file: largestNum.html Put largestNum program in an html file using a table: largestNumTable.htm Snipping Tool. Windows Explorer. Command Prompt. I've tried switching AHK from ANSI to 32-bit Unicode mode, and changing the GetModuleFileNameExA call to GetModuleFileNameExW, but this made no difference. GetModuleFileNameExW consistently returns an empty string for those windows listed above

However, if we look towards the very top of the structure, we'll find the Process Environment Block's field. Highlighting the ProcessEnvironmentBlock field of the _TEB structure. We can see that WinDbg is labelling the data-type for the field as Ptr64 _PEB. This simply means that the data-type is a pointer to the PEB structure (PPEB) STAAD.Pro CONNECT Edition is the most popular structural engineering software product for 3D model generation, analysis and multi-material design.It has an intuitive, user-friendly GUI, visualization tools, powerful analysis and design facilities and seamless integration to several other modeling and design software products

The Art Of Malware - Bringing the dead back to life

GetModuleFilenam

Delphi/C++Builder. VCL components; Database/SQL; Reports, printing; Email, Internet; Windows API; Menu; Tools API/IDE; OLE, COM, DDE; Files, drives, network; Algorithme If you prefer to download from a trusted third party website, then visit the VLC page of portableapps.com. Click the Download down button and you'll be redirected to a sourceforge.net page and the file download begins within a few seconds. The portable release of VLC Media Player runs in any version of Windows without installation Shell extensions are a powerful and flexible way to extend Windows Shell capabilities. However, when working with Shell extension handlers you can encounter hidden difficulties. In this article, we describe the general approach to creating Windows Shell extensions based on the example of shortcut menu and icon overlay handlers The version can be determined using the FileVersionInfo VI which, in LabVIEW 8.6 and later is found in the fileVersionInfo.llb found in the <LabVIEW 8.6>\vi.lib\Platform directory. We recommend using this VI rather than the VI included with this document. For LabVIEW versions prior to 8.6, you can determine the version of an executable using. Example. In C++, sequences of characters are represented by specializing the std::basic_string class with a native character type. The two major collections defined by the standard library are std::string and std::wstring:. std::string is built with elements of type char. std::wstring is built with elements of type wchar_t. To convert between the two types, use wstring_convert

The following are 6 code examples for showing how to use win32process.GetModuleFileNameEx().These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example acedGetAppName returns null. I have an arx application there I have declared a command in acrxEntryPoint.cpp that starts an about dialog. In the about dialogs OnInitDialog function I use the acedGetAppName function to get the path to my arx file. This works fine but I also have a main dialog with a menu there I also can start the exact same. You can request repair, schedule calibration, or get technical support. A valid service agreement may be required. Open a service reques Now let's use the following command to rename them. We'll then check with ls whether it worked. Remember to substitute rename with the appropriate command name for your Linux if you're not using Ubuntu or a Debian-derived Linux.. rename 's/.prog/.prg/' *.prog ls *.pr* That worked, they're now all .prg files, and there are no .prog files left in the directory

GetModuleHandleA function (libloaderapi

Steps:-1) Open C:\SProV8i SS6\STAAD\Dll1893.dll2) Copy Path i.e. C:\SProV8i SS6\STAAD\Dll1893.dll3)Open 'Command Prompt' as an Administrator 4)Type as Foll.. dlopen () The function dlopen () loads the dynamic shared object (shared library) file named by the null-terminated string filename and returns an opaque handle for the loaded object. This handle is employed with other functions in the dlopen API, such as dlsym (3), dladdr (3), dlinfo (3), and dlclose () Access to performance data was denied to user SYSTEM (value from GetUserName() for the running thread) as attempted from module C:\Program Files (x86)\VMware\VMware Player\vmware-authd.exe (value from GetModuleFileName() for the binary that issued the query)

New POS Malware Emerges - Punkey | Trustwave | SpiderLabs

C++17 in details: Filesystem. See my new website at cppstories.com. Although C++ is an old programming language, its Standard Library misses a few basic things. Features that Java or .NET had for years were/are not available in STL. With C++17 there's a nice improvement: for example, we now have the standard filesystem Hi guys, Im using cpuz for quiet some time but recently i have been noticing that cpuz fails to start for the second time and thereon. When i log on.. process_path is a crate that makes it easy to get the path of the currently executing process. Thanks to Geoffroy Couprie for the idea! The library currently provides one function: The library uses various platform specific APIs to find the appropriate path rather than relying on argv [0] and supports the following platforms I'm not very familiar with WINAPI but I think GetModuleFileName() would give you the path to the executable. You would just have to remove the filename from that path and append the relative path to the resources. Kurt 04-15-2007 #11. Nurfina. View Profile View Forum Posts Visit Homepage Registered User Join Date Apr 2007. I am using GetModuleFileName to retrieve the current path of the .exe, and then am attempting to use PathRemoveFileSpec to get rid of the filename part leaving only the directory. (This is to get the directory of the rest of the files). Now, using GetModuleFileName works fine, but I get this