Hi,

I will get back (receive) byte array from function desribed below:

[DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
public static extern int CLMQGet( out byte[] bufer );

Here below sample code:

byte[] array_byte=null;

CLMQGet( out array_byte ); // here is exeption calling

Say me why this execption is calling and how can i change my solution ?

Thanks for any help,

Regards,
Pawel

Re: How to get back byte[] when calling Win32 api function ? by Ollie

Ollie
Mon Sep 26 06:41:56 CDT 2005

you need to check out the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp

you cannot use out (or ref) with byte[] parameters because this will cause
the address of the internal object (not the buffer) to be passed to the
unmanaged code.

You should be able to just define the signature as and then change the code
accordingly:

[DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
public static extern int CLMQGet( byte[] bufer );


HTH

Ollie Riches

"Pawel" <pawelspriv@wp.pl> wrote in message
news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I will get back (receive) byte array from function desribed below:
>
> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
> public static extern int CLMQGet( out byte[] bufer );
>
> Here below sample code:
>
> byte[] array_byte=null;
>
> CLMQGet( out array_byte ); // here is exeption calling
>
> Say me why this execption is calling and how can i change my solution ?
>
> Thanks for any help,
>
> Regards,
> Pawel
>
>
>



Re: How to get back byte[] when calling Win32 api function ? by Pawel

Pawel
Mon Sep 26 07:03:04 CDT 2005

Hi,

Thanks for you response.

Can you help me how can i declare parameter in my function, that can i
receive gzip compressed buffer.

For example:
Declaration here:
[DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
public static extern int CLMQGet(here someone type but i dont know how
receive compressed gzip buffer);


My Program below:
// Here call this function
CLMQGet(here receive this compressed gzip file);

Now i will make following tasks:
1. Create file and write this buffer to file with gzip extension
2. Uncompress this gzip file.

Can you prompt me which type should i select to receive this compressed gzip
buffer
Thanks for any suggestions

Regards,
Pawel



U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
wiadomo¶ci news:e7eSt7owFHA.2656@TK2MSFTNGP09.phx.gbl...
> you need to check out the following link:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp
>
> you cannot use out (or ref) with byte[] parameters because this will cause
> the address of the internal object (not the buffer) to be passed to the
> unmanaged code.
>
> You should be able to just define the signature as and then change the
> code accordingly:
>
> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
> public static extern int CLMQGet( byte[] bufer );
>
>
> HTH
>
> Ollie Riches
>
> "Pawel" <pawelspriv@wp.pl> wrote in message
> news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
>> Hi,
>>
>> I will get back (receive) byte array from function desribed below:
>>
>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>> public static extern int CLMQGet( out byte[] bufer );
>>
>> Here below sample code:
>>
>> byte[] array_byte=null;
>>
>> CLMQGet( out array_byte ); // here is exeption calling
>>
>> Say me why this execption is calling and how can i change my solution ?
>>
>> Thanks for any help,
>>
>> Regards,
>> Pawel
>>
>>
>>
>
>



Re: How to get back byte[] when calling Win32 api function ? by Ollie

Ollie
Mon Sep 26 07:14:17 CDT 2005

where is CLMQGet defined, is it an MS defined win32 API or a third party?

Ollie Riches



"Pawel" <pawelspriv@wp.pl> wrote in message
news:%234xiBJpwFHA.2728@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> Thanks for you response.
>
> Can you help me how can i declare parameter in my function, that can i
> receive gzip compressed buffer.
>
> For example:
> Declaration here:
> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
> public static extern int CLMQGet(here someone type but i dont know how
> receive compressed gzip buffer);
>
>
> My Program below:
> // Here call this function
> CLMQGet(here receive this compressed gzip file);
>
> Now i will make following tasks:
> 1. Create file and write this buffer to file with gzip extension
> 2. Uncompress this gzip file.
>
> Can you prompt me which type should i select to receive this compressed
> gzip buffer
> Thanks for any suggestions
>
> Regards,
> Pawel
>
>
>
> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
> wiadomo¶ci news:e7eSt7owFHA.2656@TK2MSFTNGP09.phx.gbl...
>> you need to check out the following link:
>>
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp
>>
>> you cannot use out (or ref) with byte[] parameters because this will
>> cause the address of the internal object (not the buffer) to be passed to
>> the unmanaged code.
>>
>> You should be able to just define the signature as and then change the
>> code accordingly:
>>
>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>> public static extern int CLMQGet( byte[] bufer );
>>
>>
>> HTH
>>
>> Ollie Riches
>>
>> "Pawel" <pawelspriv@wp.pl> wrote in message
>> news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
>>> Hi,
>>>
>>> I will get back (receive) byte array from function desribed below:
>>>
>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>> public static extern int CLMQGet( out byte[] bufer );
>>>
>>> Here below sample code:
>>>
>>> byte[] array_byte=null;
>>>
>>> CLMQGet( out array_byte ); // here is exeption calling
>>>
>>> Say me why this execption is calling and how can i change my solution ?
>>>
>>> Thanks for any help,
>>>
>>> Regards,
>>> Pawel
>>>
>>>
>>>
>>
>>
>
>



Re: How to get back byte[] when calling Win32 api function ? by Pawel

Pawel
Mon Sep 26 07:36:52 CDT 2005

Third party function in C declared in following way :
LONG CLMQGet( LPVOID lpsBuff );

How can i receive this in C# using dotNET datatype ?

Regards,

Pawel

U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
wiadomo¶ci news:urEkyNpwFHA.2880@TK2MSFTNGP10.phx.gbl...
> where is CLMQGet defined, is it an MS defined win32 API or a third party?
>
> Ollie Riches
>
>
>
> "Pawel" <pawelspriv@wp.pl> wrote in message
> news:%234xiBJpwFHA.2728@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> Thanks for you response.
>>
>> Can you help me how can i declare parameter in my function, that can i
>> receive gzip compressed buffer.
>>
>> For example:
>> Declaration here:
>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>> public static extern int CLMQGet(here someone type but i dont know how
>> receive compressed gzip buffer);
>>
>>
>> My Program below:
>> // Here call this function
>> CLMQGet(here receive this compressed gzip file);
>>
>> Now i will make following tasks:
>> 1. Create file and write this buffer to file with gzip extension
>> 2. Uncompress this gzip file.
>>
>> Can you prompt me which type should i select to receive this compressed
>> gzip buffer
>> Thanks for any suggestions
>>
>> Regards,
>> Pawel
>>
>>
>>
>> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
>> wiadomo¶ci news:e7eSt7owFHA.2656@TK2MSFTNGP09.phx.gbl...
>>> you need to check out the following link:
>>>
>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp
>>>
>>> you cannot use out (or ref) with byte[] parameters because this will
>>> cause the address of the internal object (not the buffer) to be passed
>>> to the unmanaged code.
>>>
>>> You should be able to just define the signature as and then change the
>>> code accordingly:
>>>
>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>> public static extern int CLMQGet( byte[] bufer );
>>>
>>>
>>> HTH
>>>
>>> Ollie Riches
>>>
>>> "Pawel" <pawelspriv@wp.pl> wrote in message
>>> news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
>>>> Hi,
>>>>
>>>> I will get back (receive) byte array from function desribed below:
>>>>
>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>> public static extern int CLMQGet( out byte[] bufer );
>>>>
>>>> Here below sample code:
>>>>
>>>> byte[] array_byte=null;
>>>>
>>>> CLMQGet( out array_byte ); // here is exeption calling
>>>>
>>>> Say me why this execption is calling and how can i change my solution ?
>>>>
>>>> Thanks for any help,
>>>>
>>>> Regards,
>>>> Pawel
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: How to get back byte[] when calling Win32 api function ? by Ollie

Ollie
Mon Sep 26 07:48:00 CDT 2005

What is the LPVOID representing?

check out the following:

http://groups.google.com/groups?q=LPVOID+C%23&hl=en&lr=&sa=N&tab=wg

HTH

Ollie Riches


"Pawel" <pawelspriv@wp.pl> wrote in message
news:ed6D7bpwFHA.3720@TK2MSFTNGP11.phx.gbl...
> Third party function in C declared in following way :
> LONG CLMQGet( LPVOID lpsBuff );
>
> How can i receive this in C# using dotNET datatype ?
>
> Regards,
>
> Pawel
>
> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
> wiadomo¶ci news:urEkyNpwFHA.2880@TK2MSFTNGP10.phx.gbl...
>> where is CLMQGet defined, is it an MS defined win32 API or a third party?
>>
>> Ollie Riches
>>
>>
>>
>> "Pawel" <pawelspriv@wp.pl> wrote in message
>> news:%234xiBJpwFHA.2728@TK2MSFTNGP14.phx.gbl...
>>> Hi,
>>>
>>> Thanks for you response.
>>>
>>> Can you help me how can i declare parameter in my function, that can i
>>> receive gzip compressed buffer.
>>>
>>> For example:
>>> Declaration here:
>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>> public static extern int CLMQGet(here someone type but i dont know how
>>> receive compressed gzip buffer);
>>>
>>>
>>> My Program below:
>>> // Here call this function
>>> CLMQGet(here receive this compressed gzip file);
>>>
>>> Now i will make following tasks:
>>> 1. Create file and write this buffer to file with gzip extension
>>> 2. Uncompress this gzip file.
>>>
>>> Can you prompt me which type should i select to receive this compressed
>>> gzip buffer
>>> Thanks for any suggestions
>>>
>>> Regards,
>>> Pawel
>>>
>>>
>>>
>>> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
>>> wiadomo¶ci news:e7eSt7owFHA.2656@TK2MSFTNGP09.phx.gbl...
>>>> you need to check out the following link:
>>>>
>>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp
>>>>
>>>> you cannot use out (or ref) with byte[] parameters because this will
>>>> cause the address of the internal object (not the buffer) to be passed
>>>> to the unmanaged code.
>>>>
>>>> You should be able to just define the signature as and then change the
>>>> code accordingly:
>>>>
>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>> public static extern int CLMQGet( byte[] bufer );
>>>>
>>>>
>>>> HTH
>>>>
>>>> Ollie Riches
>>>>
>>>> "Pawel" <pawelspriv@wp.pl> wrote in message
>>>> news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
>>>>> Hi,
>>>>>
>>>>> I will get back (receive) byte array from function desribed below:
>>>>>
>>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>>> public static extern int CLMQGet( out byte[] bufer );
>>>>>
>>>>> Here below sample code:
>>>>>
>>>>> byte[] array_byte=null;
>>>>>
>>>>> CLMQGet( out array_byte ); // here is exeption calling
>>>>>
>>>>> Say me why this execption is calling and how can i change my solution
>>>>> ?
>>>>>
>>>>> Thanks for any help,
>>>>>
>>>>> Regards,
>>>>> Pawel
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: How to get back byte[] when calling Win32 api function ? by Pawel

Pawel
Mon Sep 26 07:54:04 CDT 2005

Hi,
LPVOID lpsBuff - this is a pointer for someone buffer in memory that is
compressed with gzip (befor was writing to this buffer )

Pawel

U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
wiadomo¶ci news:uEiQogpwFHA.3588@tk2msftngp13.phx.gbl...
> What is the LPVOID representing?
>
> check out the following:
>
> http://groups.google.com/groups?q=LPVOID+C%23&hl=en&lr=&sa=N&tab=wg
>
> HTH
>
> Ollie Riches
>
>
> "Pawel" <pawelspriv@wp.pl> wrote in message
> news:ed6D7bpwFHA.3720@TK2MSFTNGP11.phx.gbl...
>> Third party function in C declared in following way :
>> LONG CLMQGet( LPVOID lpsBuff );
>>
>> How can i receive this in C# using dotNET datatype ?
>>
>> Regards,
>>
>> Pawel
>>
>> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
>> wiadomo¶ci news:urEkyNpwFHA.2880@TK2MSFTNGP10.phx.gbl...
>>> where is CLMQGet defined, is it an MS defined win32 API or a third
>>> party?
>>>
>>> Ollie Riches
>>>
>>>
>>>
>>> "Pawel" <pawelspriv@wp.pl> wrote in message
>>> news:%234xiBJpwFHA.2728@TK2MSFTNGP14.phx.gbl...
>>>> Hi,
>>>>
>>>> Thanks for you response.
>>>>
>>>> Can you help me how can i declare parameter in my function, that can i
>>>> receive gzip compressed buffer.
>>>>
>>>> For example:
>>>> Declaration here:
>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>> public static extern int CLMQGet(here someone type but i dont know how
>>>> receive compressed gzip buffer);
>>>>
>>>>
>>>> My Program below:
>>>> // Here call this function
>>>> CLMQGet(here receive this compressed gzip file);
>>>>
>>>> Now i will make following tasks:
>>>> 1. Create file and write this buffer to file with gzip extension
>>>> 2. Uncompress this gzip file.
>>>>
>>>> Can you prompt me which type should i select to receive this compressed
>>>> gzip buffer
>>>> Thanks for any suggestions
>>>>
>>>> Regards,
>>>> Pawel
>>>>
>>>>
>>>>
>>>> U¿ytkownik "Ollie Riches" <ollie.riches@phoneanalyser.net> napisa³ w
>>>> wiadomo¶ci news:e7eSt7owFHA.2656@TK2MSFTNGP09.phx.gbl...
>>>>> you need to check out the following link:
>>>>>
>>>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconDefaultMarshalingForArrays.asp
>>>>>
>>>>> you cannot use out (or ref) with byte[] parameters because this will
>>>>> cause the address of the internal object (not the buffer) to be passed
>>>>> to the unmanaged code.
>>>>>
>>>>> You should be able to just define the signature as and then change the
>>>>> code accordingly:
>>>>>
>>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>>> public static extern int CLMQGet( byte[] bufer );
>>>>>
>>>>>
>>>>> HTH
>>>>>
>>>>> Ollie Riches
>>>>>
>>>>> "Pawel" <pawelspriv@wp.pl> wrote in message
>>>>> news:eXsYkTowFHA.1132@TK2MSFTNGP10.phx.gbl...
>>>>>> Hi,
>>>>>>
>>>>>> I will get back (receive) byte array from function desribed below:
>>>>>>
>>>>>> [DllImport("clamqa.dll", CharSet=CharSet.Ansi, EntryPoint="CLMQGet")]
>>>>>> public static extern int CLMQGet( out byte[] bufer );
>>>>>>
>>>>>> Here below sample code:
>>>>>>
>>>>>> byte[] array_byte=null;
>>>>>>
>>>>>> CLMQGet( out array_byte ); // here is exeption calling
>>>>>>
>>>>>> Say me why this execption is calling and how can i change my solution
>>>>>> ?
>>>>>>
>>>>>> Thanks for any help,
>>>>>>
>>>>>> Regards,
>>>>>> Pawel
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>