Pinvoke reading files, returning char * values.



Hello,
I am trying to use an Win32 DLL developed using Visual C++ 6.0 in my
C# .net application.

The signature of the original function is as follows :

BOOL __stdcall GetXMLString(
const char* strInputFileName,
const char* strPassword,
char* strOutput,
char* strErrorMessage)


So, this function takes the path of a file and a password and returns
back a string.


I translated like this :


[DllImport("STLKit.dll", CharSet=CharSet.Auto )]
public static extern bool GetXMLString(string inputFileName,
string
password,
ref
StringBuilder output,
string
errorMessage);


However this is not working at all and the output parameter is being
populated by weird messages like "publictoken" or "Dependancy
Evaluated" and so on.

My questions are :

Are these the correct mappings ?
Could there be a problem sending a file path to the function ?


Any help/pointers would really be very appreciated.


Thanks,
Anirudh

.



Relevant Pages

  • Re: Implementing strstr
    ... that string doesn't appear at all). ... const char* strstr(const char* haystack, const char* needle) ...
    (comp.programming)
  • curses mouse cut/paste on solaris2.9, hangs on select(). Works fine on aix and linux
    ... The program works fine on solaris, if the user inputs the string from ... const char *defaultText = NULL; ... void tstWprintw; ... int main ...
    (comp.unix.solaris)
  • Pinvoke reading files, returning char * values.
    ... back a string. ... public static extern bool GetXMLString(string inputFileName, ... StringBuilder output, ... Could there be a problem sending a file path to the function? ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Whats wrong with the string?
    ... Then it is better to use "const char *" so that the ... >> putc() is a function to put a char on the serial console. ... the str could point beyond the end of your string. ... characters to characters. ...
    (comp.os.linux.embedded)
  • Re: Destroy a string
    ... "rossum" wrote in message ... const char overwriteChar = 'X'; ... The string is still on the heap, ... completely secure, all that is possible is to make the attacker's job ...
    (microsoft.public.dotnet.languages.csharp)

Loading