Posts: 89
Joined: Sep 2012
Reputation:
1
2013-07-20, 11:05
(This post was last modified: 2013-07-20, 16:13 by Skixbmc.)
I need help with the DynamicDll.h
The code for Windows is assembly en we have to get a 16 byte alligned stack. Has somebody a solution for that problem?
Thanks!
Silverstone Grandia GD02-MT | AMD A8-3850 | Breakaway Audio Enhancer, HK AVR-365 | HKTS 30, Philips 50PFL7956H/12 21:9 3D
Posts: 89
Joined: Sep 2012
Reputation:
1
Yups, found the nasty, nasty bug:
diff --git a/xbmc/cores/DllLoader/Win32DllLoader.cpp b/xbmc/cores/DllLoader/Win32DllLoader.cpp
index de84d4d..16d5e78 100644
--- a/xbmc/cores/DllLoader/Win32DllLoader.cpp
+++ b/xbmc/cores/DllLoader/Win32DllLoader.cpp
@@ -303,13 +303,17 @@ void Win32DllLoader::OverrideImports(const CStdString &dll)
DWORD old_prot = 0;
// change to protection settings so we can write to memory area
- VirtualProtect((PVOID)&first_thunk[j].u1.Function, 4, PAGE_EXECUTE_READWRITE, &old_prot);
+ VirtualProtect((PVOID)&first_thunk[j].u1.Function, sizeof(first_thunk[j].u1.Function), PAGE_EXECUTE_READWRITE, &old_prot);
// patch the address of function to point to our overridden version
+#ifdef _WIN64
+ first_thunk[j].u1.Function = (DWORD_PTR)fixup;
+#else
first_thunk[j].u1.Function = (DWORD)fixup;
+#endif
// reset to old settings
- VirtualProtect((PVOID)&first_thunk[j].u1.Function, 4, old_prot, &old_prot);
+ VirtualProtect((PVOID)&first_thunk[j].u1.Function, sizeof(first_thunk[j].u1.Function), old_prot, &old_prot);
}
}
}
@@ -363,12 +367,12 @@ void Win32DllLoader::RestoreImports()
// change to protection settings so we can write to memory area
DWORD old_prot = 0;
- VirtualProtect(import.table, 4, PAGE_EXECUTE_READWRITE, &old_prot);
+ VirtualProtect(import.table, sizeof(import.table), PAGE_EXECUTE_READWRITE, &old_prot);
*(DWORD *)import.table = import.function;
// reset to old settings
- VirtualProtect(import.table, 4, old_prot, &old_prot);
+ VirtualProtect(import.table, sizeof(import.table), old_prot, &old_prot);
}
}
Only I am not sure what to do with *(DWORD *)import.table = import.function; , the table is 8 bytes long and the function is only four bytes long...
I think that class Import in Win32DllLoader.h the DWORD function should be void *
Silverstone Grandia GD02-MT | AMD A8-3850 | Breakaway Audio Enhancer, HK AVR-365 | HKTS 30, Philips 50PFL7956H/12 21:9 3D
Posts: 16,946
Joined: Feb 2011
Reputation:
256
I am osx dev - here it is i386 and x86_64 ... But that is up to WiSo (the win dev)
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much:
click here
HowTo setup NFS for Kodi:
NFS (wiki)
HowTo configure avahi (zeroconf):
Avahi_Zeroconf (wiki)
READ THE IOS FAQ!:
iOS FAQ (wiki)
Posts: 2,745
Joined: Oct 2003
Reputation:
1
WiSo
Team-Kodi Developer
Posts: 2,745
I vote for lib64. Nice work in general but ...
I see this as proof of concept as it shows how difficult it is to get a working 64bit XBMC and I assume maintaining it afterwards will be hard as well (different bugs 32bit vs. 64bit, new third party libs without 64bit upstream, etc).
As long as I'm the "only" platform dev for windows this won't be merged as I can't take care of it.
Posts: 2,745
Joined: Oct 2003
Reputation:
1
WiSo
Team-Kodi Developer
Posts: 2,745
Btw if you find bugs don't wait until this is ready. Make a pr for master and done.