# GetSystemDirectory A or W module could not be found

**URL:** <https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787>\
**Category:** Windows\
**Created:** [October 14, 2018, 10:03pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787 "2018-10-14T22:03:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [October 14, 2018, 10:03pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/1 "2018-10-14T22:03:46Z")

</div>

Hi Everyone,

I am confused by the declares for GetSystemDirectoryA or GetSystemDirectoryW not available with the System.IsFunctionAvailable command, and yet calling the function will correctly return the System Directory. I have tried many different ways of creating the declare, and am not sure why the IsFunctionAvailable cannot recognize this function. Maybe I have been on the computer too long 🙂

Here is the code which shows that both events are not available:

[code]Sub Action() Handles Action  
#If TargetWindows  
Soft Declare Function GetSystemDirectoryW Lib “Kernel32.dll” (lpBuffer As Ptr, nSize As UInt32) As UInt32  
Soft Declare Function GetSystemDirectoryA Lib “Kernel32.dll” (lpBuffer As Ptr, nSize As UInt32) As UInt32

```
If System.IsFunctionAvailable("GetSystemDirectoryW", "Kernel32.drv") Then
  System.DebugLog "GetSystemDirectoryW in Action Event is Available"
Else
  System.DebugLog "GetSystemDirectoryW in Action Event is not Available"
End If

If System.IsFunctionAvailable("GetSystemDirectoryA", "Kernel32.drv") Then
  System.DebugLog "GetSystemDirectoryA in Action Event is Available"
Else
  System.DebugLog "GetSystemDirectoryA in Action Event is not Available"
End If
//Error 126 - The specified module could not be found

```

#Endif

End Sub  
[/code]

How can I have this function available? I could just ignore IsFunctionAvailable, and then this would be a concern on an older Windows OS when the Unicode version is called. Any helpful thoughts? Thanks 🙂

Edit: This is on Windows 10, Xojo 2018 r2.

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [October 14, 2018, 10:07pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/2 "2018-10-14T22:07:08Z")

</div>

Yep… on the computer for too long… the Kernel32.drv should be Kernel32.dll. 🙂

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [October 14, 2018, 10:13pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/3 "2018-10-14T22:13:43Z")

</div>

The power of posting your problem on the forum. 2 minute later you find the issue (after looking at it for a long time) 🙂

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [October 14, 2018, 10:25pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/4 "2018-10-14T22:25:49Z")

</div>

> [@409860:@Alberto De Poo](#):
>
> The power of posting your problem on the forum. 2 minute later you find the issue (after looking at it for a long time) 🙂

You are correct 🙂

---

<div class="post-metadata">

**Author:** ![Anthony\_Dellos](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_dellos/32/208_2.png) [@Anthony\_Dellos](https://forum.xojo.com/u/Anthony_Dellos)\
**Post date:** [October 15, 2018, 3:06pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/5 "2018-10-15T15:06:39Z")

</div>

[https://en.wikipedia.org/wiki/Rubber\_duck\_debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging) 🙂

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [October 15, 2018, 3:30pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/6 "2018-10-15T15:30:45Z")

</div>

Anthony,

Thats a perfect explanation about debugging, and its the first time that I have heard that term. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:25pm UTC](https://forum.xojo.com/t/getsystemdirectory-a-or-w-module-could-not-be-found/45787/7 "2020-10-29T19:25:03Z")

</div>


