Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dllexp_SetLedData returns ERROR_INSUFFICIENT_BUFFER when setting any configuration #10

Open
windows2000bug opened this issue Apr 17, 2018 · 35 comments
Labels
bug Something isn't working no repro Need instructions to reliably reproduce

Comments

@windows2000bug
Copy link

Got message yesterday and forgot to save it. It mentioned some buffer got full and would not allow me to change colors of the lights. I even switched to RGB Fusion and I couldn't do anything with that. The only way I got it to work again was to turn the PC off and kill the power. The LEDs stayed lit after shutdown and went off after I killed the main power switch.

@tylerszabo
Copy link
Owner

tylerszabo commented Apr 17, 2018 via email

@tylerszabo
Copy link
Owner

Is this related to #8 ?

@windows2000bug
Copy link
Author

No it looks like I might be introducing an issue when I have RGB Fusion running at the same time and I switch the lights off from Fusion. I am working to see if I can more easily reproduce the issue on a more consistent basis:

C:\Users\israel\Desktop\rgb fusion>RGBFusionTool.exe -v --color white
Static color: Color [White]
Brightness: 100
Usage: RGBFusionTool.exe [OPTION]...
Set RGB Fusion motherboard LEDs

Options:
-v, --verbose
-c, --color, --static=VALUE
set static color
--cycle, --colorcycle[=SECONDS]
cycle colors, changing color every SECONDS
-b, --brightness=VALUE brightness (0-100)
-l, --list list zones
-?, -h, --help show help and exit

Error: GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_SetLedData returned ERROR_INSUFFICIENT_BUFFER
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.CheckReturn(String apiFunction, UInt32 result)
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.SetLedData(IEnumerable`1 settings)
at GLedApiDotNet.RGBFusionMotherboard.Set(Int32[] divisions)
at GLedApiDotNet.RGBFusionMotherboard.SetAll(LedSetting ledSetting)
at RGBFusionTool.RGBFusionMain.LazyMotherboard.SetAll(LedSetting ledSetting)
at RGBFusionTool.Application.Main(String[] args)

This might be completely avoided if I or other users don't have RGB Fusion open or using both at the same time.

@windows2000bug
Copy link
Author

Just for testing, I powered off my system and pulled the power. I then launched windows and started using the tool w/o even launching RGB Fusion. Just to make sure there was nothing in the buffer.

When repeated commands in quick succession:
RGBFusionTool.exe -v --color blue
Static color: Color [Blue]
Brightness: 100

RGBFusionTool.exe -v --color blue
Static color: Color [Blue]
Brightness: 100

RGBFusionTool.exe -v --color blue
Static color: Color [Blue]
Brightness: 100

RGBFusionTool.exe -v --color blue
Static color: Color [Blue]
Brightness: 100
Usage: RGBFusionTool.exe [OPTION]...
Set RGB Fusion motherboard LEDs

Options:
-v, --verbose
-c, --color, --static=VALUE
set static color
--cycle, --colorcycle[=SECONDS]
cycle colors, changing color every SECONDS
-b, --brightness=VALUE brightness (0-100)
-l, --list list zones
-?, -h, --help show help and exit

Error: GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_SetLedData returned ERROR_INSUFFICIENT_BUFFER
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.CheckReturn(String apiFunction, UInt32 result)
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.SetLedData(IEnumerable`1 settings)
at GLedApiDotNet.RGBFusionMotherboard.Set(Int32[] divisions)
at GLedApiDotNet.RGBFusionMotherboard.SetAll(LedSetting ledSetting)
at RGBFusionTool.RGBFusionMain.LazyMotherboard.SetAll(LedSetting ledSetting)
at RGBFusionTool.Application.Main(String[] args)

In both of these two cases tonight, I was able to continue using after getting the error message. This unlike last night where the lights were unresponsive, even after reboot. To fix that, I had to pull the power.

@tylerszabo
Copy link
Owner

tylerszabo commented Apr 18, 2018

I suspect that having this tool run while anything else is trying to set LEDs will not work well. Gigabyte's tools go to some effort to kill other processes that might be trying to set lights. I've created issue #11 to track work on detecting and warning of conflicting processes.

@tylerszabo tylerszabo added bug Something isn't working duplicate This issue or pull request already exists no repro Need instructions to reliably reproduce and removed duplicate This issue or pull request already exists bug Something isn't working labels Apr 20, 2018
@windows2000bug
Copy link
Author

I did try on a fresh boot w/o starting the Fusion UI, though on startup there has to be some processes associated with Fusion as the lights come on, when I login to Windows. I was able to generate this one entering a lot of commands in quick succession. Do you have Fusion installed and/or running in the background?

@tylerszabo
Copy link
Owner

Whenever you run one of those tools Gigabyte puts some daemons in startup. I put a list of processes I've identified in issue #11.

@tylerszabo tylerszabo added the bug Something isn't working label Apr 24, 2018
@windows2000bug
Copy link
Author

I keep upping the sleep time and I don't know if it really has any effect on throwing this error. It isn't one zone in particular. Granted once I get setting multi zone, I am hoping it will help, though it might also turn into an all or nothing.

@windows2000bug
Copy link
Author

Good news the tool can run w/o RGB Fusion installed, bad news it didn't fix the issue. I did different tests and I can not find anything in common that would cause the problem. I wrote a SPAM script to help test:

$path = $PSScriptRoot + "\RGBFusionTool.exe"

$x=0
while ($true) {

if ($x -eq 0) {
    $rgb="red"
} elseif ($x -eq 1) {
    $rgb="green"
} elseif ($x -eq 2) {
    $rgb="blue"
    $x=-1
}
& $path -v -c $rgb
write-host $x   
sleep  2

$x+=1

}

I will up the time a lot to like 5 seconds on sleep to see if it is just a red herring or not.

@trparky
Copy link

trparky commented May 15, 2018

I tried doing a complete shutdown of my system including flipping the switch on the back of my power supply and I still can't get the program to work when compiled from source. The program does work when using the provided binary but that really shouldn't matter. Right? Is it something I'm doing wrong in the compile phase?

@windows2000bug
Copy link
Author

TBH I never compiled from source and just used the binaries. Just wondering what Motherboard you are using?

@tylerszabo
Copy link
Owner

@trparky have you tried from an elevated prompt? I still don't know under what conditions you need to be elevated to get this to work (I don't need it, but others have had issues when running from a non-elevated prompt).

@tylerszabo tylerszabo changed the title Buffer Full GLedAPI returns ERROR_INSUFFICIENT_BUFFER when setting any configuration May 15, 2018
@trparky
Copy link

trparky commented May 15, 2018

Tried in an elevated command prompt, didn't work either. Gigabyte Z370 AORUS Ultra Gaming.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_InitAPI returned ERROR_INSUFFICIENT_BUFFER

@tylerszabo
Copy link
Owner

Hmm, the one you compile should work just as well as the provided binary. Especially if you're using the same GLedApi.dll, layout.ini, and ycc.dll (ensure they are in the same folder as the EXE you build).

@trparky
Copy link

trparky commented May 15, 2018

Oh yeah, I was missing the ycc.dll and layout.ini files. I feel like an idiot.

@tylerszabo
Copy link
Owner

No worries, this is actually worth addressing as a feature. I've created issue #25 to capture the need for better dependency checking and more meaningful error output.

@MichaelXF
Copy link

I pretty sure I got all the dependencies ( GLedApi.dll, GLedApiDotNet.dll, layout.ini, Mono.Options.dll, & ycc.dll ) but now i get this response from doing:

RGBFusionTool.exe --static=RED

I get the following:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_GetMaxDivision returned 0xFFFFFFFF
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.GetMaxDivision() in C:\Users\Michael\Desktop\RGB-Fusion-Tool-master (2)\RGB-Fusion-Tool-master\GLedApiDotNet\Raw\GLedAPIv1_0_0Wrapper.cs:line 54
at GLedApiDotNet.RGBFusionMotherboard..ctor(GLedAPIv1_0_0Wrapper wrapperAPI) in C:\Users\Michael\Desktop\RGB-Fusion-Tool-master (2)\RGB-Fusion-Tool-master\GLedApiDotNet\RGBFusionMotherboard.cs:line 152
at GLedApiDotNet.RGBFusionMotherboard..ctor() in C:\Users\Michael\Desktop\RGB-Fusion-Tool-master (2)\RGB-Fusion-Tool-master\GLedApiDotNet\RGBFusionMotherboard.cs:line 163
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Lazy`1.get_Value()
at RGBFusionTool.RGBFusionMain.LazyMotherboard.SetAll(LedSetting ledSetting) in C:\Users\Michael\Desktop\RGB-Fusion-Tool-master (2)\RGB-Fusion-Tool-master\RGBFusionTool\RGBFusionMain.cs:line 25
at RGBFusionTool.Application.Main(String[] args) in C:\Users\Michael\Desktop\RGB-Fusion-Tool-master (2)\RGB-Fusion-Tool-master\RGBFusionTool\Application.cs:line 234

Am i doing something wrong? The --help works perfectly but setting the colors will pause for about 6 seconds then spit the error mess ( I pasted above this )

@tylerszabo
Copy link
Owner

Would you paste the output of the following PowerShell script:

$winver = [System.Environment]::OSVersion.Version.ToString()
$toolver = (Get-Item .\RGBFusionTool.exe).VersionInfo.FileVersion.ToString()
$hashes = @("GLedApi.dll", "GLedApiDotNet.dll", "layout.ini", "Mono.Options.dll", "RGBFusionTool.exe", "ycc.dll") | % { Get-FileHash -Algorithm SHA256 -Path $_ }
$biosversion = (Get-WmiObject -Class Win32_BIOS).SMBIOSBIOSVersion
$motherboard = (Get-WmiObject -Class Win32_BaseBoard).Product

Write-Host -ForegroundColor White -BackgroundColor Black @"
``````
- Windows Version: $winver
- RGB Fusion Tool Version: $toolver
- Motherboard: $motherboard
- BIOS: $biosversion

Hashes:

$(($hashes | % { "$($_.Hash) $(Split-Path -Leaf $_.Path)"}) -join "`n")
``````
"@
Out-Null | Write-Host

@MichaelXF
Copy link

MichaelXF commented Jul 12, 2018

I got the following:

  • Windows Version: 10.0.16299.0
  • RGB Fusion Tool Version: 0.9.1
  • Motherboard: AB350-Gaming 3-CF
  • BIOS: F22

Hashes:

2C0DCD27AF18DABBE679ED915AE772A561072FF9C7AA8218284A017223945459 GLedApi.dll
37380E704593B5A8169BDE0E395F5AAB0DCA8DE227049DB36C0E42250E01B8B8 GLedApiDotNet.dll
702A91752CE59B11078AB8F3428ECD1F871267D8AD45E414173CCF0A69FEE9D4 layout.ini
05FC657EB5B5D563DE7807DF6EE07FC8B89DC6F6F08EB76C30E5192429FBBDCF Mono.Options.dll
3882A3C2A34B0B2B120903C89970B0C83A0F8B42673825C66F21594F4ED9F576 RGBFusionTool.exe
64BF4B2F0C84333E239DDA24F82BF8EAD22B7DB905C50FADE262283CA96703AD ycc.dll

@tylerszabo
Copy link
Owner

I notice one oddity and I'd like you to try with the GLedApi.dll, ycc.dll, and layout.ini from B18.0206.1.zip.

It does look like your AB350-Gaming 3 is supported, so that's good 🙂. If you've tried Gigabyte's RGB Fusion tools have they worked ? No need to go installing it just yet if you haven't, but it'll help to identify what's up.

2C0DCD27AF18DABBE679ED915AE772A561072FF9C7AA8218284A017223945459 is an interesting hash for GLedApi.dll. I've seen the following hashes for GLedApi.dll:

  • 1D0D8D01382CD2617AEA26162C2A3FA2FF845B93A815882CC74B512568DF6BC4 in B17.0926.1.zip
  • D39AB2041C3A93ECB38CE446BBBC1C3DA1E3292EC25A301E4ADF3A588EE7A8F3 in B18.0206.1.zip

I searched VirusTotal for the your hash and there are no hits. So I'm not sure what version of GLedApi.dll you're using or if it's corrupted.

If you downloaded an SDK right from Gigabyte you can check the hashes against the ones I have in README.md if you're concerned there may be corruption.

I also see that your hashes for GLedApiDotNet.dll and RGBFusionTool.exe differ from the ones in the Github v0.9.1 release, did you build them locally (it should still work if built locally - I don't do anything fancy in the build)?

If you download the v0.9.1 release from the Github releases it should have the following SHA256 8c25bd393e0592ad170da79b5f2f9fb6df425985c508bb0b6a7479dcf3aa3ae3.

@MichaelXF
Copy link

MichaelXF commented Jul 13, 2018

I re-downloaded the whole RGBFusionTool and just pressing F5 (to build), and using the .dlls from B18.0206.1.zip I get the following results:

- Windows Version: 10.0.16299.0
- RGB Fusion Tool Version: 0.9.1
- Motherboard: AB350-Gaming 3-CF
- BIOS: F22

Hashes:

D39AB2041C3A93ECB38CE446BBBC1C3DA1E3292EC25A301E4ADF3A588EE7A8F3 GLedApi.dll
EC9EC108FA5767202D6E1EEDB7FE5708CC114FEFD3ACBD99900C9F8F56F964D2 GLedApiDotNet.dll
702A91752CE59B11078AB8F3428ECD1F871267D8AD45E414173CCF0A69FEE9D4 layout.ini
05FC657EB5B5D563DE7807DF6EE07FC8B89DC6F6F08EB76C30E5192429FBBDCF Mono.Options.dll
CEA8E8DA7785E4D186E17130A6D9C63FFFADD3A2B69C3321F6A63E16E10FCEAC RGBFusionTool.exe
64BF4B2F0C84333E239DDA24F82BF8EAD22B7DB905C50FADE262283CA96703AD ycc.dll

but I'm stilling getting the weird errors, I tried unplugging my cooler's RGB connector from my mobo to see maybe thats the problem, but the problem still is present, the RGB Fusion app works fine.

The error occurs around GLedAPIv1_0_0Wrapper.cs line: 51 the rawApi.GetMaxDivision() which returns a negative number and throws the exception: throw new GLedAPIv1_0_0Exception("dllexp_GetMaxDivision", unchecked ((uint)result)) that I'm seeing...

I've also tried using the GLedApi.dll, ycc.dll, and layout.ini from the built test in B18.0206.1.zip and from the RGBFusion app but I can't seem to fix this.

Here I'm using the RGBFusion app and using the "Random" preset:
https://drive.google.com/file/d/13XZ7XrNASZZFF91-X51TWlYK0BbBzosZ/view

@MichaelXF
Copy link

MichaelXF commented Jul 13, 2018

Also with using the build test in B18.0206.1.zip:
B18.0206.1\Sample\Motherbaord\GLedApi\Debug\testGLedApi.exe
when pressing "Set" in the Motherboard LED section I get "Invalid allocation size: 4290000005"
(the 4290000005 isn't the exact number but it's a really big number)

@MichaelXF
Copy link

After thoughts: Maybe I shoud've gotten an MSI/Asus motherboard...

@tylerszabo
Copy link
Owner

tylerszabo commented Jul 13, 2018

I'm guessing that number was 4294967295 (which is 0xFFFFFFFF as a signed 32 bit integer). The test app doesn't do any error checking so that would be an attempt to allocate an array with 4.2 billion 16-byte LED setting structs. I'm kinda glad it crashed before trying to pass a 68 GB array to hardware.

Good news is the RGB Fusion GUI stuff works so your hardware is probably in good shape. If you look in layout.ini you see that your board isn't listed (by name, anyway) so it's possible they haven't added SDK support for it, yet.

Worth noting that it's really hard to screw up calling into the SDK at this point since calls take any input until after dllexp_GetMaxDivision. You can see in the RGBFusionMotherboard constructor that all that's called by that point is GetSdkVersion(), Initialize() and then GetMaxDivision(). This leads me to believe that it's Gigabyte's SDK. Especially, given the behavior of the included test tool (returning -1 from dllexp_GetMaxDivision call).

If you're on Reddit I find /r/gigabytegaming/ to be a good place to mention issues - others with the same motherboard might have found a way to recover and one of the GBT_ people might be able to pass it on to the devs.

I've created issue #30 to track this bug. I'll see if I can find a way to hack in support for your motherboard in the meantime.

@tylerszabo tylerszabo removed the no repro Need instructions to reliably reproduce label Jul 13, 2018
@tylerszabo tylerszabo changed the title GLedAPI returns ERROR_INSUFFICIENT_BUFFER when setting any configuration dllexp_SetLedData returns ERROR_INSUFFICIENT_BUFFER when setting any configuration Jul 13, 2018
@tylerszabo
Copy link
Owner

I was able to reproduce a variation on the issue by removing the entry for my motherboard from layout.ini. In this case I will get the error: dllexp_GetLedLayout returned ERROR_INSUFFICIENT_BUFFER. The initial occurrence of this bug was in dllexp_SetLedLayout (which would happen after a call to dllexp_GetLedLayout).

I thought there was a repro, however there is not. I've updated the title and returned the "no repro" tag.

@tylerszabo tylerszabo added the no repro Need instructions to reliably reproduce label Jul 13, 2018
@slangza
Copy link

slangza commented Jan 1, 2019

I have the same issue.

Initially, my RGB's are stuck on WHITE. RGBFusion from gigabyte nor via the bios was able to turn the RGB's off or change color. Was hoping the app fixes the problem, but instead I'm getting the famous ERROR_INSUFFICIENT_BUFFER as well.

Did a full powerdown as as suggested somewhere

Any idea how to fix this as I couldn't really see a solution on this issue

@oblivion2k
Copy link

oblivion2k commented Mar 29, 2019

I've started getting this error after updating my AORUS X470 Gaming Wifi BIOS to the F6 revision. LEDS are stuck on orange full brightness, and Gigabyte's RGBFusion does not work either.

I'll perform a full shutdown with power switch on the next chance I get, and provide updates.

@slangza
Copy link

slangza commented Mar 29, 2019

@oblivion2k
I have sent my motherboard back to the supplier, will receive feedback by next week from them

@oblivion2k
Copy link

Gigabyte's RGBFusion 2.0 works correctly after an overnight full shutdown with PSU switch off, but RGB Fusion Tool still has the same error, something must have changed between F2 and F6 BIOS revisions to trigger this.

@tylerszabo
Copy link
Owner

Have you tried the new version of the SDK? I haven't had a chance to test it so I didn't package it yet you can find it here: https://www.gigabyte.com/mb/rgb/sdk

@MobKill3r2006
Copy link

Any updates on this error?

@tylerszabo
Copy link
Owner

@MobKill3r2006 sadly, no - without the hardware to test against or another spec or SDK from Gigabyte this project is stuck with what's offered. There have been some other projects that did more to reverse engineer what Gigabyte is doing and you might consider those. I'd like to work on top of what they're offering; but given the lack of support I'd look to other vendors altogether for lighting. I think Corsair makes a controller that's well supported; @windows2000bug is someone to ask about options.

@MobKill3r2006
Copy link

Alright, damn it. This was the only project I found that uses code to control the lights on my motherboard. I wanted to make a program that controls both the lights on my motherboard and on my razer keyboard. Thanks, however.

@gusdrawn
Copy link

Same issue with x570 aorus ultra

@The13thTimelord
Copy link

I seem to have the exact same issue using a Z390 I AORUS Pro Wifi mini-itx I get the following:

Error: GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_InitAPI returned ERROR_INSUFFICIENT_BUFFER
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.CheckReturn(String apiFunction, UInt32 result) in C:\RGBFusion\Source\GLedApiDotNet\Raw\GLedAPIv1_0_0Wrapper.cs:line 31
at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.Initialize() in C:\RGBFusion\Source\GLedApiDotNet\Raw\GLedAPIv1_0_0Wrapper.cs:line 45
at GLedApiDotNet.RGBFusionMotherboard..ctor(GLedAPIv1_0_0Wrapper wrapperAPI) in C:\RGBFusion\Source\GLedApiDotNet\RGBFusionMotherboard.cs:line 147
at GLedApiDotNet.RGBFusionMotherboard..ctor() in C:\RGBFusion\Source\GLedApiDotNet\RGBFusionMotherboard.cs:line 160
at RGBFusionTool.RGBFusionMain.<>c.

b__0_0() in C:\RGBFusion\Source\RGBFusionTool\RGBFusionMain.cs:line 20
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at System.Lazy1.get_Value()
at RGBFusionTool.Application.Main(String[] args) in C:\RGBFusion\Source\RGBFusionTool\Application.cs:line 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no repro Need instructions to reliably reproduce
Projects
None yet
Development

No branches or pull requests

9 participants