comskip82_007 ReleaseSemaphore error on Windows 7

Here you can ask your questions on how to use Comskip for the detection of commercials. Also questions on how to remove commercials are welcome
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

It looks like this was asked over on AVSForum previously, but didn't really get an answer there.
https://www.avsforum.com/forum/26-home- ... rsion.html

I just upgraded my comskip donators version to 82_007 on my Windows 7 DVR PC, and it as soon as it runs, a message box comes up saying:
The procedure entry point ReleaseSemaphore could not be located in the dynamic link library api-ms-win-core-synch-l1-2-1.dll.
So it looks like this ReleaseSemaphore function was only added to that DLL in Windows 10, per this page:
https://docs.microsoft.com/en-us/window ... core-alpha

My guess is you're building with the Windows 10 SDK and it's just attempting to load some Kernel32.lib API imports this way. You probably just need to redefine WINVER and _WIN32_WINNT to _WIN32_WINNT_WIN7 (0x0601), and rebuild comskip.
https://docs.microsoft.com/en-us/cpp/po ... ew=vs-2019

Anyway, please build an updated Windows 7 compatible comskip donators if you can. Or if you're really depending on something in the new SDK, let us know and us Windows 7 users will just have to stick with the previous compatible version (comskip82_003_donators) from now on.

Thanks!
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

I've build release 008 with the windows 7 define as you requested.
Can you test?
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Thanks for the quick response! Sure I can test.

Unfortunately I still see the same ReleaseSemaphore error on Windows 7.
It does seem improved, in that the "Image Ver" column of Dependency Walker (http://dependencywalker.com/) for comskip.exe now shows "6.1" rather than "6.3" for most dependencies -- Except for API-MS-WIN-CORE-SYNCH-L1-2-0.DLL.

I'm not sure why it would be that way for just one file. It appears you might be building with the 10.0.14393 SDK, or targeting that version of Windows.
You might want to check the "Version" or "Minimum Required Version" in your linker options.
Or perhaps you could try Project > Retarget solution... in Visual Studio and select an older Windows SDK version, such as 8.1.

Maybe running dumpbin /ALL comskip.exe could shed some light on this too:
https://docs.microsoft.com/en-us/cpp/bu ... ew=vs-2019

Also, was that one a donator version? I saw it under http://www.kaashoek.com/files/ but not at http://www.kaashoek.com/donators/

Thanks!
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

Small problem, I'm building using MINGW otherwise I can not build libavcodec from source.
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Actually what I said before was incorrect.
Comskip82_007 and comskip82_008 are mostly identical, according to dependency walker and dumpbin.
There were just some additional differences between donator and non-donator versions.

So let's see... dumpbin /IMPORTS says this about that DLL:
api-ms-win-core-synch-l1-2-0.dll
4C988F0 Import Address Table
4C984A4 Import Name Table
0 time date stamp
0 Index of first forwarder reference

1F ReleaseSemaphore
23 Sleep
2C WaitForSingleObjectEx

By the way, the NTSTATUS error code is 0xc0000139 (Entry Point Not Found)
"The procedure entry point %hs could not be located in the dynamic link library %hs"
And if you examine api-ms-win-core-synch-l1-2-0.dll on Windows 7 it doesn't contain a ReleaseSemaphore entry point.
You could try Googling that error code and see if there are any suggestions for MINGW to get around that.

Hmm... it seems difficult to even see the issue on a Windows 10 machine, because the dependencies are all there.
Are you able to test on Windows 7 at all? Preferably with a debugger.

You could also try using the Dependency Walker Profiling to detect dynamic dependencies, which we seem to have here for the ReleaseSemaphore function
http://www.dependencywalker.com/help/ht ... filing.htm
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

I tried installing a couple of runtime updates from Microsoft:

The latest supported Visual C++ downloads - "x64: vc_redist.x64.exe"
https://support.microsoft.com/en-us/hel ... -downloads

Update for Universal C Runtime in Windows - "All supported x64-based versions of Windows 7"
https://support.microsoft.com/en-us/hel ... in-windows

But this didn't help either.

So you're using MINGW. Which compiler and Windows SDK versions are you using exactly?
If you give me some basic instructions on how to set up your environment, I can try to reproduce this.
Menelmacar
Posts: 1
Joined: Wed Jun 19, 2019 4:57 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by Menelmacar »

I had to rebuild my win7 x64 media center system onto another workstation last week as a result of bad caps on my old system's motherboard.

I downloaded comskip82_007_donators on the 14th. I get the same error when launching comskip.exe as Nebulous saying "The procedure entry point releasesemaphore could not be location in the dynamic link library api-ms-win-core-synch-l1-2-0.dll".

I don't see the 008 release mentioned but logged into the donator page again today and see version comskip82_009_donators but unfortunately that leads to the same error message. As nebulous mentioned I then went back and downloaded the next previous version comskip82_003_donators and it works with no errors.

I am not a programmer or compiler but when searching the error I ran across another program with the same error. Maybe this will give insight to fix ongoing versions of comskip for win7.

https://github.com/rust-lang/rust/issues/49438
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Interesting link there Menelmacar.

So I think you should try to remove any dependencies on synchronization.lib (the "synchapi" module?) Here's their change for that:
https://github.com/alexcrichton/parking ... 3b1798124a

Hopefully after the synchronization.lib dependency is gone, the linker can locate the ReleaseSemaphore function in Kernel32.lib again.
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

Solving this will require some serious time for debugging and testing
At the moment I'm rather busy and can not promise this will be done soon.
Hope to have more time after August
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Understood. I can try and investigate further...

Is comskip source code still available? http://comskip.org/ says it's at svn://svn.kaashoek.com but it's not working?

Also does the code include any instructions on how to set up the MINGW build?
How do I get libavcodec - is it just from the ffmpeg source? http://ffmpeg.org/download.html#get-sources
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

Latest source is on github
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Ok I finally got around to this. :? I got the source from github and built using MSYS2 and MinGW-w64. It built AND run OK on a Windows 7 machine.
Problem is, the comskip.exe I built depends on msys2.dll and others. Why is that?

The builds at at http://www.kaashoek.com/files/ or http://www.kaashoek.com/donators don't have that dependency on msys2.dll. How is your build environment set up? How were you building comskip where it didn't require MSYS2 to be installed?

Thanks,
Ryan
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

Interresting, I'm building with msys and mingw too
Do you have somewhere the instructions of how you did setup your build environment?
nebulous999
Posts: 11
Joined: Sun Jun 09, 2019 9:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by nebulous999 »

Sorry, I lost the HDD on the PC I was using, so no.

Maybe the key to avoiding the ReleaseSemaphore is to build it on a Windows 7 machine.
You could just try running MinGW-w64 (or whatever build system) in compatibility mode for Windows 7 .

Or, if you have Windows 10 Pro, you could enable Enable Hyper-V:
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
Create a virtual machine:
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/quick-create-virtual-machine
And install a copy of Windows 7 on the new VM.

I can probably try rebuilding the latest Comskip on Win7 this weekend. I'll create some instructions on how I set up my environment.
erik
Site Admin
Posts: 3368
Joined: Sun Aug 21, 2005 3:49 pm

Re: comskip82_007 ReleaseSemaphore error on Windows 7

Post by erik »

That would help!
Post Reply