Search found 10 matches

by sepp
Wed Aug 15, 2012 3:17 pm
Forum: Windows
Topic: Invalid Memory Access when executing callback via DLL
Replies: 2
Views: 1622

Re: Invalid Memory Access when executing callback via DLL

Thanks STARGÅTE, you are right, @mainfunction is wrong it must be @mainfunction()!
Then it also works with CALL, but with Prototype it is much nicer :D
by sepp
Wed Aug 15, 2012 1:40 pm
Forum: Windows
Topic: Invalid Memory Access when executing callback via DLL
Replies: 2
Views: 1622

Invalid Memory Access when executing callback via DLL

Hello all,

I am trying to execute a callback-routine via DLL, where I am passing the address of the callback-routine as parameter. The parameter is arriving at the DLL correctly, but when calling it (via Inline-Assembler-function CALL) I always get "Invalid Memory Access".

Does anyone have an idea ...
by sepp
Wed Aug 08, 2012 1:15 pm
Forum: Windows
Topic: Unable to read same file in parallel
Replies: 7
Views: 1860

Re: Unable to read same file in parallel

#FILE_SHARE_READ | #FILE_SHARE_WRITE

You used logical Or instead of bitwise |
BINGO :lol:

As #FILE_SHARE_READ=1 and #FILE_SHARE_WRITE=2 the conjunction #FILE_SHARE_READ Or #FILE_SHARE_WRITE = 1 Or 2 = 1 but #FILE_SHARE_READ | #FILE_SHARE_WRITE = 1 | 2 = 3. So it could not work as the Writer ...
by sepp
Wed Aug 08, 2012 9:16 am
Forum: Windows
Topic: Unable to read same file in parallel
Replies: 7
Views: 1860

Re: Unable to read same file in parallel

Thanks RichAlgeni for your reply.

The manual says that a mutex only works within one programm (but several threads). The code above was just an example, actually I am having 3 seperate applications (1 writer, 2 readers).

You are closing the filehandle before releasing the mutex, that would be ...
by sepp
Tue Aug 07, 2012 11:41 pm
Forum: Windows
Topic: Unable to read same file in parallel
Replies: 7
Views: 1860

Unable to read same file in parallel

Hello all,

I need to read a logfile in two different applications at the same time. As PB internal functions do not allow to set the Share-Mode I am using direct API-Calls. There I am using #FILE_SHARE_READ, but the second call always fails with error-code 32: ERROR_SHARING_VIOLATION: - The process ...
by sepp
Tue Aug 07, 2012 11:31 pm
Forum: Windows
Topic: Converting Windows-Filehandle to Purebasic-Filehandle
Replies: 2
Views: 1194

Re: Converting Windows-Filehandle to Purebasic-Filehandle

does anyone know if it is possible to convert a Windows-filehandle to a Purebasic-filehandle?
I don't think this is possible. You can convert from a PureBasic-filehandle to an OS-filehandle but not the other way around. CreateFile_() only assigns a filehandle and won't use a specified filehandle ...
by sepp
Mon Aug 06, 2012 10:46 pm
Forum: Windows
Topic: Converting Windows-Filehandle to Purebasic-Filehandle
Replies: 2
Views: 1194

Converting Windows-Filehandle to Purebasic-Filehandle

Hello all,

does anyone know if it is possible to convert a Windows-filehandle to a Purebasic-filehandle?
I want to read a logfile, but as ReadFile can not read shared-read I want to use CreateFile_.

I found a structure which seems to be a PureBasic-filehandle (http://www.purebasic.fr/german ...
by sepp
Mon Jul 30, 2012 9:02 am
Forum: Windows
Topic: NSIS-DLL with Purebasic
Replies: 2
Views: 1574

Re: NSIS-DLL with Purebasic

Got it now with help of the NSIS-forum: NSIS-DLL's must use the cdecl calling convention (Windows-default is stdcall) whereas the calling function cleans the stack (at stdcall the callee cleans the stack).

So ProcedureCDLL must be used instead of ProcedureDLL, that's it :D

dlltest.pb
Structure ...
by sepp
Sun Jul 29, 2012 10:07 pm
Forum: Windows
Topic: NSIS-DLL with Purebasic
Replies: 2
Views: 1574

Re: NSIS-DLL with Purebasic

Got a little bit further, parameter passing works now, but created Exe is always crashing with errocode 0xc0000005.
Any ideas?

dlltest.pb

Structure TCHAR
char.i
EndStructure

Structure stack_t
*Next.stack_t
text.s{1024}
EndStructure

ProcedureDLL testprocedure(hwndParent.i, string_size.i ...
by sepp
Sat Jul 28, 2012 11:52 pm
Forum: Windows
Topic: NSIS-DLL with Purebasic
Replies: 2
Views: 1574

NSIS-DLL with Purebasic

Hello all,

I'm wondering if anyone has tried to create a NSIS-DLL with Purebasic and can share it here?
I was able to call the function in the DLL, but I am not able to pass a parameter.

Thanks,
Sepp

Example C-Plugin:
http://nsis.sourceforge.net/Examples/Plugin/

dlltest.nsi
!addplugindir ...