 |
|
|
Hi
When I run dependency walker over a dll that has been created using ExportDll I get the following dlls that could not be found: c:\windows\system32\ADVAPI32.DLL c:\windows\system32\MPR.DLL c:\windows\system32\SHLWAPI.DLL c:\windows\system32\USER32.DLL
Do you know how or why this is happening?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Ugh ? .NET dlls depends on a) MSCOREE.DLL only (which depends on "windows core" dlls like those U mentioned) without using PInvoke b) other native dlls if U're using PInvoke
I dont where is ur problem
...works fascinates me...i can stare it for hours...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
hi I am working with vc6++ only. how can I use MSTSC.MSRDPClient in c++ vc6++ only? (aspecially I am searching how to sink the MSRdpClient_OnDisconnect Event to a c++ win32 static linked lib. )
only simple code
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi Selvin,
Could you explain to me step by step how to export a function in a visual basic dll created in Visual Studio 2008?
Thanks a lot
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi all,
I created a dll in Visual Basic using Visual Studio 2008 and I need to export the only function (Ocr) in the dll. I tried what you wrote at "http://www.codeproject.com/KB/dotnet/DllExport.aspx" to export my dll but it doesn't change when I compile it since when I use Dependecy Walker I don't see any exported method in my dll. I summarize what I did following your instructions:
1)I created my dll in Visual Studio 2008 as a project Class Library in Visual Basic.My dll is called Bollettino.dll. It contains only a Sub called Ocr.
2) I downloaded the ExportDll code and I added ExportAttribute.dll as an address in my project .
3) Before the Sub Ocr I added in my code the statement ExportDllAttribute.ExportDll("Ocr()", System.Runtime.InteropServices.CallingConvention.Cdecl); _
ecause ExportDll.exe needs to know which functions need to be exported.
4) I add in Project property named "Post-build event command" the following statement
C:\Release\ExportDll.exe C:\Projects_VS_2008\Bollettino\Bollettino\bin\Release\Bollettino.dll /$(ConfigurationName)
thata represents the paths of ExportDll and of my dll
5) I compile my dll but it doesn't happen...Because I don't see any exported method in my dll if I use Dependency Walker. I don't receive any error messages and I don't understand why it doesn't work.
What is wrong in my procedure??? Can you help me??
I hope that this message could be read by Slevin who is the author of the article I refers to.
Thanks in advance.
Bye
P.S Here is the code:
Public Class Class1
'[ExportDll("Ocr",System.Runtime.InteropServices.CallingConvention.Cdecl)] <ExportDllAttribute.ExportDll("Ocr()", System.Runtime.InteropServices.CallingConvention.Cdecl)> _ Public Sub Ocr()
Dim inputFile As String = "C:\\Boll.tif" Dim strRecText As String = "" Dim Doc1 As MODI.Document
Doc1 = New MODI.Document Doc1.Create(inputFile) Doc1.OCR() ' this will ocr all pages of a multi-page tiff file Doc1.Save() ' this will save the deskewed reoriented images, and the OCR text, back to the inputFile
For imageCounter As Integer = 0 To (Doc1.Images.Count - 1) ' work your way through each page of results strRecText &= Doc1.Images(imageCounter).Layout.Text ' this puts the ocr results into a string Next
System.IO.File.Delete("C:\\test5.txt")
System.IO.File.AppendAllText("C:\\test5.txt", strRecText) ' write the OCR file out to disk 'System.IO.File.Create("C:\\test2.txt", strRecText)
Doc1.Close() ' clean up Doc1 = Nothing
End Sub
End Class
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello I have a question, this exe can compile a dll for 64 bits operating system or is necesary to change something?
thanks and regards
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
i really don't know(coz i didn't test) but i think - it should work there as well
...works fascinates me...i can stare it for hours...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
...or (if its not working)... change
wholeilfile.Add(string.Format(".vtfixup [{0}] int32 fromunmanaged at VT_01", exportscount)); wholeilfile.Add(string.Format(".data VT_01 = int32[{0}]", exportscount)); to
wholeilfile.Add(string.Format(".vtfixup [{0}] int64 fromunmanaged at VT_01", exportscount)); wholeilfile.Add(string.Format(".data VT_01 = int64[{0}]", exportscount));
...works fascinates me...i can stare it for hours...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
new source few bugs fixed -CallConvStdcall bug(thnx. Lesha M.) -marshal( xxxxx) if you are using [return : MarshalAs( xxxx)] attribute
sample project both managed and unamanaged added you can download it here
...works fascinates me...i can stare it for hours...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello,
I dont know how to integrate my .net class library project with your Exportdll and Exportdll attribute.
Could you please provide step by step guide to convert my dll in to unmanaged dll, as I am new to .net
Please advise.
Thanks in Advance.
Regards, Kesavan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
First of all, solution is excellent. Thank's a lot.
A little error occured in line 21 at the file ExportDllAttribute.cs, that disables export in Cdecl format.
There are: dic[System.Runtime.InteropServices.CallingConvention.Cdecl] = typeof(CallConvStdcall).FullName;
Seem's to be: dic[System.Runtime.InteropServices.CallingConvention.Cdecl] = typeof(CallConvCdecl).FullName;
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
When i add the exporting to post build action, it works without any problem. But when I try to do it manually like ExportDLL.exe path\dll_name, then i am getting following messages and it doesn't work.
Debug: False Unverifiable code failed policy check. (Exception from HRESULT: 0x80131402
Could anyone help, thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
I was getting this problem too, but then I realised that it was because I had run the ExportDll.exe twice. The first time, it was automatically during the post-build step mentioned about (I forgot about this at the time). The 2nd time was when I was manually trying to do it at the command-prompt.
After doing some googling on this error message, I read that this error might be due to having unmanaged code, and then it made sense.
On the 1st run, it went from C#-managed to C3-slightly unmanaged (in order to export the functions you need). So on the 2nd run, I guess ILDASM could no-longer allow dis-assembling of an unmanaged dll? (I'm guessing it was something like that).
Not sure if that was your issue, but thought I'd share my experiences here, just in-case others experience the same thing.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Have you tried this with a strong named DLL? It seems not to work... 
Debug: True Could not load file or assembly '32768 bytes loaded from ExportDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e90ce7b9c6c47c11' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: The command ""C:\TerminalServicesRISPACS\Code\RISiExtend\TangoCentricity\src\Bridge\VirtualChannel\ExportDll\ExportDll\bin\Debug\ExportDll.exe" "C:\TerminalServicesRISPACS\Code\RISiExtend\TangoCentricity\src\Bridge\VirtualChannel\RisVirtualChannelClient\bin\Debug\RisVirtualChannelClient.dll" /Debug C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: " exited with code -1. Done building project "RisVirtualChannelClient.csproj" -- FAILED.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
I was wondering if anyone could help me with this. I had a hunch that this would be useable in-conjunction with DllMain which is exported by regular Win32 DLL's. I tried the following code and loaded it using LoadLibrary in unmanaged code:
using System; using System.Collections.Generic; using System.Text;
namespace InjectTest1 { public class EntryPoint { [ExportDllAttribute.ExportDll("DllMain", System.Runtime.InteropServices.CallingConvention.StdCall)] int DllMain(IntPtr Module, int Reason, IntPtr Reserved) { System.Windows.Forms.MessageBox.Show("This is a test."); return 1; } } }
However it is not automatically called. I know you can call DllMain with GetProcAddress, but I was hoping you could do this with legacy applications of which you do not possess the source-code.
Thanks to anyone that has any information!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
try use cctor
using System; using System.Collections.Generic; using System.Text;
namespace InjectTest1 { public class EntryPoint { static EntryPoint() { System.Windows.Forms.MessageBox.Show("This is a test."); } } }
...works fascinates me...i can stare it for hours...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
I tried cctor but it wasn't getting called. It might be because of the way I am using the C# DLL, I am injecting it into a process rather than loading with LoadLibrary.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
First of all, great work. I have been looking for a while now for something that will be anywhere closer to allowing me to export a function from a .NET assembly. I hope your work will get me there.
I am trying to use your code to export a method in an assembly for use by RunDll32.exe. The prototype that RunDll32.exe expects is:
void CALLBACK RunDll_FunctionName(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
I created a class where I have a method defined as follows:
public static void MyMethod_RunDLL(IntPtr hwnd, IntPtr hinst, string lpszCmdLine, int nCmdShow)
I use the ExportDllAttribute with "MyMethod_RunDLL" as the export name. I have tried all different calling conventions.
Any idea why RunDll32.exe may not find the exported method? Perhaps I am not using the code as intended?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
As I indicated in my original post, I want to export a function that will be callable by RunDll32.exe. So, I would like to create an assembly (dll) in C# and use your tool, if it does the job, to export the function(s). Thanks for any help you can provide.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |