If you are coming from java, you are probalby used to the ideal world of
VM programming, where everything is abstracted away from the actual
platform you are running on.
What you are trying to do with replacing kernel32.dll pokes around in
very lowlevel Windows specific implementation details.
To avoid any confusing on my end, the files I need are
kernel33.dll (original kernel32.dll)
kernel33.def (So d can acces those functions)
kernel32.def (renaming happens over here, contains a list of all
import-exported functions)
kernel32.d (the code)
kernel33.def can be seen as a substitute for t
Yes, and i have a kernel32.def for my .d file and a kernel33.def for the
original kernel dll. Your not confused, I am. I thought i needed kerel33.def
so i could acces the dll from d, isnt this the case?
Op 1-mei-2011 22:10 schreef "Rainer Schuetze" het
volgende:
> I must have completely misunderst
I must have completely misunderstood what you want to do. What do you
want to build from kernel33.def? Isn't kernel33.dll the original DLL
that you want to intercept by replacing it with the compiled DLL?
maarten van damme wrote:
Great, now the error in kernel32.def is resolved but it gets the
Great, now the error in kernel32.def is resolved but it gets the same
problem in kernel33.def.
here is the start of the exports from kernel33.def:
EXPORTS
_hread @1334
how can I change this to resolve that?
2011/5/1 Rainer Schuetze
> It seems you have hit another of those dreaded optlink bugs.
>
It seems you have hit another of those dreaded optlink bugs.
With less symbols, it works if you declare the imports like this
(because of the described name mangling):
IMPORTS
_imported_hread@0 = kernel33._hread
2 more notes:
- you don't need to import kernel33.di
- you should not u
Number overflow?
So I implemented the suggested changes (you can check them out at
http://dl.dropbox.com/u/15024434/version2.zip)
But now I get when I compile it :
"kernel32.def(738) : Error 12: Number Overflow: (strange symbol over here)"
I do agree I should've picked a simpler example but I thin
Wow, thanks for the help
The first thing I did was in the .di file adding extern(windows){ ... }
and now compiling doesn't give errors and when examining with dllexp I can
see that it exports the same functions as the real kernel32.dll :D
Now I'm going to implement all other suggested changes, tha
On Sat, 30 Apr 2011 13:47:53 +0400, maarten van damme
wrote:
I've changed this, I think I'm still kinda confused with lib files.
They've
told me you can't do something with them without a .di file
So I went ahead and made a kernel33.di file. I now import it in
kernel32.d
and my declarati
I'm not sure your wrapping will work with kernel32.dll, but in general
here are a few tips:
- most functions in the windows API use the __stdcall calling convention
in C/C++, which translates to D as "extern(Windows)"
- this will usually add the number of bytes passed on the stack as a
"@NN"
I've changed this, I think I'm still kinda confused with lib files. They've
told me you can't do something with them without a .di file
So I went ahead and made a kernel33.di file. I now import it in kernel32.d
and my declaration is
System(C){
export void * exportedfunctionblablabal(){
return ex
I'm afraid I've been a little unclear.
I've copied kernel32.dll from the windows dir, renamed it to kernel33.dll
and generated a .lib from it using implib.
Then I've created a d file with a correct dllmain(stolen from examples) and
between
system(C){
export void * exportedfunctionfromkernel33.dll(
That example was a bit incomplete, preceding was the following code:
import std.c.windows.windows;
import core.dll_helper;
pragma(lib,"kernel33.lib");
__gshared HINSTANCE g_hInst;
extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
switch (ulReason)
{
On Thu, 21 Apr 2011 12:31:56 -0400, maarten van damme
wrote:
according to dllexp.exe (a dll examiner) my dll does not export any
functions.
So there is something wrong in my declaration:
pragma(lib,kernel33.lib);
extern(C){
export void * functionfromkernel33.lib () ;
...
}
How can one write
according to dllexp.exe (a dll examiner) my dll does not export any
functions.
So there is something wrong in my declaration:
pragma(lib,kernel33.lib);
extern(C){
export void * functionfromkernel33.lib () ;
...
}
How can one write this correctly?
2011/4/21 maarten van damme
> There is another
There is another problem, I don't know the return types of the functions
from that dll, so I gave them the type "void *". I think this is incorrect.
I've tried with the little knowledge I have from d and in the link is my
kernel32.d. I have compiled it succesfully in a .dll but the application
usin
On Thu, 21 Apr 2011 07:49:14 -0400, maarten van damme
wrote:
Hello, I'm back (I've been ill, nothing serious)
I woul really like a bit more explanation with that particular approach.
Would declaring the functions I want to keep from the renamed dll in a
extern(c) block and linking that to the
Hello, I'm back (I've been ill, nothing serious)
I woul really like a bit more explanation with that particular approach.
Would declaring the functions I want to keep from the renamed dll in a
extern(c) block and linking that to the renamed dll while also declaring
them as export work?
And the func
On Mon, 18 Apr 2011 04:11:16 -0400, maarten van damme
wrote:
The problem with that aproach would be that the functions are in another
location in the export table.
I've read that the locations need to stay exactly the same.
Am I wrong about this?
I don't know for sure, but my gut would say
The problem with that aproach would be that the functions are in another
location in the export table.
I've read that the locations need to stay exactly the same.
Am I wrong about this?
2011/4/18 Robert Jacques
> On Sun, 17 Apr 2011 16:09:02 -0400, maarten van damme <
> maartenvd1...@gmail.com>
On Sun, 17 Apr 2011 16:09:02 -0400, maarten van damme
wrote:
Hello everyone, this is my second post in the digitalmars.d newsgroup
and I
hope it gets as good support and suggestions as my first post :)
I'm playing around with the d programming language and am trying out some
exotic things
21 matches
Mail list logo