WineHQ
Bug Tracking Database – Bug 35061

 Bugzilla

 

Last modified: 2020-12-29 06:18:16 UTC  

GoldCoin 0.7.1.7 shows assertion on startup (needs ntdll.NtQuerySemaphore implementation)

Bug 35061 - GoldCoin 0.7.1.7 shows assertion on startup (needs ntdll.NtQuerySemaphore implementation)
GoldCoin 0.7.1.7 shows assertion on startup (needs ntdll.NtQuerySemaphore imp...
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: ntdll
1.7.8
x86-64 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
https://web.archive.org/web/201404030...
: download, patch
: 44056 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2013-12-06 16:05 UTC by Heindrich
Modified: 2020-12-29 06:18 UTC (History)
2 users (show)

See Also:
Regression SHA1:
Fixed by SHA1: bfb4f28dc5f4ddbb4f94b33e50beb7407f08f305
Distribution: ---
Staged patchset:


Attachments
patch (3.67 KB, text/plain)
2013-12-06 19:20 UTC, Dmitry Timoshkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Heindrich 2013-12-06 16:05:34 UTC
When trying to install goldcoin-0.7.1.7-win32-setup app the system indicates it needs Gecko and it can auto download. I download but then message is: "Assertion failed" and it shows C:\deps\boost/interprocess/detail/windows_intermodule_sin?eton.hpp 
Line 145
Please note the question mark above is a letter that I wrote down but can't make it out now.

It also shows Expression: "&get.map.unlocked()==m"
Comment 1 Heindrich 2013-12-06 16:09:56 UTC
I did save the log file and sent it at the time of failure of the app.
Comment 2 Anastasius Focht 2013-12-06 16:32:47 UTC
Hello folks,

confirming, the assertion is shown on startup.
Installation is fine.

Relevant part of trace log:

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/GoldCoin (GLD)
...
WINEDEBUG=+tid,+seh,+relay wine ./goldcoin-qt.exe >>log.txt 2>&1
...
0024:Call KERNEL32.CreateSemaphoreA(00000000,00000000,7fffffff,05b2182c "bipc_gmap_sem_count_35_13030842308.621462") ret=007a9c4d
0024:Ret  KERNEL32.CreateSemaphoreA() retval=0000038c ret=007a9c4d
0024:Call KERNEL32.GetLastError() ret=007a9c59
0024:Ret  KERNEL32.GetLastError() retval=00000000 ret=007a9c59
0024:Call KERNEL32.CreateSemaphoreA(00000000,00000000,016c7cb0,05b2182c "bipc_gmap_sem_map_35_13030842308.621462") ret=007a9b46
0024:Ret  KERNEL32.CreateSemaphoreA() retval=00000390 ret=007a9b46
0024:Call KERNEL32.GetLastError() ret=007a9b52
0024:Ret  KERNEL32.GetLastError() retval=00000000 ret=007a9b52
0024:Call KERNEL32.InterlockedCompareExchange(00921e14,00000001,00000000) ret=007a6473
0024:Ret  KERNEL32.InterlockedCompareExchange() retval=00000000 ret=007a6473
0024:Call KERNEL32.InterlockedCompareExchange(00921e04,00000001,00000000) ret=007a63bd
0024:Ret  KERNEL32.InterlockedCompareExchange() retval=00000000 ret=007a63bd
0024:Call KERNEL32.GetModuleHandleA(0092353f "ntdll.dll") ret=007a63f9
0024:Ret  KERNEL32.GetModuleHandleA() retval=7bc10000 ret=007a63f9
0024:Call KERNEL32.InterlockedIncrement(00921e04) ret=007a640c
0024:Ret  KERNEL32.InterlockedIncrement() retval=00000002 ret=007a640c
0024:Call KERNEL32.GetProcAddress(7bc10000,009235a7 "NtQuerySemaphore") ret=007a64d9
0024:Ret  KERNEL32.GetProcAddress() retval=7bc22010 ret=007a64d9
0024:Call KERNEL32.InterlockedIncrement(00921e14) ret=007a64ec
0024:Ret  KERNEL32.InterlockedIncrement() retval=00000002 ret=007a64ec
0024:Call ntdll.NtQuerySemaphore(00000390,00000000,00eef4a8,00000008,00eef4bc) ret=007a9bf6
0024:fixme:ntdll:NtQuerySemaphore (0x390,0,0xeef4a8,0x00000008,0xeef4bc) stub!
0024:Ret  ntdll.NtQuerySemaphore() retval=00000000 ret=007a9bf6
0024:Call msvcrt._assert(0092367f "&get_map_unlocked() == m",009235c8 "c:\\deps\\boost/boost/interprocess/detail/windows_intermodule_singleton.hpp",00000091) ret=007a9c28 
...
0024:Call user32.MessageBoxIndirectW(00eed3a4) ret=7ed5306a
--- snip ---

BTW .. that software is ported to various OS (including Linux):

http://gldcoin.com/get-started/

Anyway, good test-case for Wine ;-)

$ sha1sum goldcoin-0.7.1.7-win32-setup.exe 
9393b859bbd5b570046c6d3b10ba31c02ddc26e9  goldcoin-0.7.1.7-win32-setup.exe

$ du -sh goldcoin-0.7.1.7-win32-setup.exe 
9.4M	goldcoin-0.7.1.7-win32-setup.exe

$ wine --version
wine-1.7.8-128-g37460b6

Regards
Comment 3 Anastasius Focht 2013-12-06 16:52:53 UTC
Hello folks,

fortunately the assert gives some hints at the code base and how the semaphore wrapper is implemented/being used.

http://www.boost.org/doc/libs/1_55_0/boost/interprocess/detail/windows_intermodule_singleton.hpp

--- snip ---
...
class windows_semaphore_based_map
{
   typedef std::map<std::string, ref_count_ptr> map_type;

   public:
   windows_semaphore_based_map()
   {
...
      bool created = false;
      const permissions & perm = permissions();
      std::string pid_creation_time, name;
      get_pid_creation_time_str(pid_creation_time);
      name = "bipc_gmap_sem_lock_";
      name += pid_creation_time;
      bool success = m_mtx_lock.open_or_create(name.c_str(), perm);
      name = "bipc_gmap_sem_count_";
      name += pid_creation_time;
      scoped_lock<winapi_mutex_wrapper> lck(m_mtx_lock);
      {
         success = success && m_sem_count.open_or_create
            ( name.c_str(), static_cast<long>(0), winapi_semaphore_wrapper::MaxCount, perm, created);
         name = "bipc_gmap_sem_map_";
         name += pid_creation_time;
         success = success && m_sem_map.open_or_create
            (name.c_str(), initial_count, max_count, perm, created);
         if(!success){
            delete m;
            //winapi_xxx wrappers do the cleanup...
            throw int(0);
         }
         if(!created){
            delete m;
         }
         else{
            BOOST_ASSERT(&get_map_unlocked() == m);
         }
         m_sem_count.post();
      }
   }
...
   map_type &get_map_unlocked()
   {
      if(sizeof(void*) == sizeof(boost::uint32_t)){
         union caster_union
         {
            void *addr;
            boost::uint32_t addr_uint32;
         } caster;
         caster.addr = 0;
         caster.addr_uint32 = m_sem_map.limit();
         caster.addr_uint32 = caster.addr_uint32 << 2;
         return *static_cast<map_type*>(caster.addr);
      }
      else{
         union caster_union
         {
            void *addr;
            boost::uint64_t addr_uint64;
         } caster;
         boost::uint32_t max_count(m_sem_map.limit()), initial_count(m_sem_map.value());
         //Clear quasi-top bit
         max_count &= boost::uint32_t(0xBFFFFFFF);
         caster.addr_uint64 = max_count;
         caster.addr_uint64 =  caster.addr_uint64 << 32;
         caster.addr_uint64 |= boost::uint64_t(initial_count) << 2;
         return *static_cast<map_type*>(caster.addr);
      }
   }

--- snip ---

http://www.boost.org/doc/libs/1_55_0/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp

--- snip ---
class winapi_semaphore_functions
{
...
  long limit() const
   {
      long l_count, l_limit;
      if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit))
         return 0;
      return l_limit;
   }
...
--- snip ---

http://www.boost.org/doc/libs/1_55_0/boost/interprocess/detail/win32_api.hpp

--- snip ---
inline bool get_semaphore_info(void *handle, long &count, long &limit)
{
   winapi::interprocess_semaphore_basic_information info;
   winapi::NtQuerySemaphore_t pNtQuerySemaphore =
         (winapi::NtQuerySemaphore_t)dll_func::get(winapi::dll_func::NtQuerySemaphore);
   unsigned int ret_len;
   long status = pNtQuerySemaphore(handle, winapi::semaphore_basic_information, &info, sizeof(info), &ret_len);
   count = info.count;
   limit = info.limit;
   return !status;
}
--- snip ---

Wine source: http://source.winehq.org/git/wine.git/blob/4af4df5af3cffd3e1b18932e4fbedbae10c8b2b6:/dlls/ntdll/sync.c#l214

--- snip ---
214 NTSTATUS WINAPI NtQuerySemaphore(
215         HANDLE SemaphoreHandle,
216         SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
217         PVOID SemaphoreInformation,
218         ULONG Length,
219         PULONG ReturnLength)
220 {
221         FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
222         SemaphoreHandle, SemaphoreInformationClass, SemaphoreInformation, Length, ReturnLength);
223         return STATUS_SUCCESS;
224 }
--- snip ---

Regards
Comment 4 Dmitry Timoshkov 2013-12-06 19:20:53 UTC
Created attachment 46768 [details]
patch

Attached patch implements NtQuerySemaphore/SemaphoreBasicInformation.

'tools/make_requests' must be executed after the patch gets applied.
Comment 5 Anastasius Focht 2013-12-26 13:19:00 UTC
Hello folks,

this is fixed by commit http://source.winehq.org/git/wine.git/commitdiff/bfb4f28dc5f4ddbb4f94b33e50beb7407f08f305

Thanks Dmitry

Regards
Comment 6 Alexandre Julliard 2014-01-03 13:10:27 UTC
Closing bugs fixed in 1.7.10.
Comment 7 Anastasius Focht 2020-12-29 06:17:01 UTC
*** Bug 44056 has been marked as a duplicate of this bug. ***


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers