How can I call an unmanaged COM object within ASP.Net 3.5 - asp.net-3.5

I have an unmanaged COM object, and I would like to call it from ASP.NET 3.5.
Can I just call it like in C# or do I have to write something special in the web.config, or configure the IIS specialy.
Right now I'm getting a stackoverflow exception.

You can't just call a com object from managed code. You have to P/Invoke it. Check out pinvoke.net for how to p/invoke most of the windows API. There is also a tool for generating p/invoke code called the p/invoke interop assistant.
As to why you're getting the overflow, its probably unrelated to any com calls. You're probably doing something else wrong. Check your properties, its one of the most common places you'll end up with a SO. Also, check your call stack at the point of the overflow, as it will tell you what method(s) is/are causing the issue.

For .NET projects you have the COM tab in the "Add References" dialog. Add a reference to your COM object and it should just work.
If it works on a development machine, but not in production you just have to check all the usual suspects:
Is the COM object (and dependencies) registered on the production server.
Does the web server run in 64 bit? That will stop you from running 32 bit COM object in process.

Related

Why can't I debug into UnityEngine.UI code?

I add the UnityEngine.UI.dll and UnityEditor.UI.dll to my assets folder with their mdb files . also i add the both project to my current project. i am sure all the unity engine ugui code build success, because i debug log in the event system, and it print message. when i want to step into the event system class, i always failed . I find unity will load the code from a build path ,rather than i original code. Why does it do this ? if i want to debug unity engine ugui code, what should i do ?
To debug code, you need two things:
Symbols, the list of all functions, classes, variables used throughout the module. When using C++ symbols are stored in special .pdb files on Windows (and you obviously are using Windows since you are talking about dlls). Symbols in C# (.NET in general) are stored in the .dll itself. Having symbols will let you see the name of functions on the call stack and possibly some variables but nothing more.
Source code of the module.
U3D's source code is proprietary - you need to spend a good amount of money to receive it. And if I am guess to - UnityEngine.UI.dll is a C++ module with stripped (removed) symbols removed.
Thus you have neither, so you can't debug U3D's code at all.
Why would you need to that anyway? If you want to see how the internals of a big game engine work, there are plenty of other options (for example UE4 and Lumberyard). If you are struggling with a problem and you'd like to be able to solve it through debugging...well though luck. Your best bet would be to ask in unity community.

IDA Pro script to resolve indirect API calls?

Often, especially when dealing with malware files, you'll end up in a situation where all the APIs are dynamically resolved at runtime inside a given buffer, this approach considerably slow down the reversing process (and makes the decompiler useless: (DWORD *)dword_123456(INT, UINT)()) because the analyst has to run the malware, resolve the api and by hand put a comment next to each api call. I've found the indirectcalls plugin, but it seems to work only with "standard" C++ methods. Is there any script, or funcionality I don't know about, that's able to patch the executable, even during the debugging, in order to call the APIs with their real names?
There is a script called renimp.idc that is shipped with IDA in the idc folder of IDA's installation directory. Just attach IDA at runtime (in cases of malware analysis you will probably better want to use a remote debugger), navigate to the API address table created by the unpacker and select all entries. Then run the said script. It will rename all pointers to the correct API it points to, so IDA's type-library is able to resolve the correct typedefs for it from it's internal database again.

References to LOGNS in Microsoft Enterprise Library Code

I inherited a small Microsoft Enterprise Library project that supposedly worked a couple of months ago. From what I can tell, it has code that was lifted directly from the Enterprise Library source (?!) instead of linking the built DLLs.
Sigh.
So, there are classes that don't compile in the Microsoft.Practices.ENterpriseLibrary.* namespaces. There's a reference to a cryptic LOGNS namespace which has a static LogHelper class with a bunch of Log* methods.
I can't figure anything out about this class, other than that it's missing (and trivial to stub out), but I'm concerned that I may be missing some references (in my GAC?) or something.
This is one trivial error out of several; I have a feeling this code did work (since it's ten projects in a solution), and only that I'm missing something locally.
But what?
There's no such namespace or class in Enterprise Library. Sounds like you didn't get all the source code.
Well, no current versions - any idea what version of Entlib you're dealing with?

System.Data.MetadataException - seems more stubborn than most people's

I have gone through this post and the links, and still can't solve my issue.
I have changed my config to name the assembly, but it makes no odds.
We recently moved the projects and think that might be an issue - but how to solve it if so. I don't quite understand how EF when running finds the cdsl etc. files I thought they were embedded in the dll [it is set to do so]?
The service having the issue doesn't directly use EF itself, it uses another DLL which DOES. I also added a direct ref to the DLL but no joy.
Also, the same code (the dll that contains the functionality, not the wrapper service) using the same connections strings works fine in my system test project via the IDE.
Turned out to be down to incorrect initialisation of StructureMap and not really to do with EF itself.

Where can I find VBSQL.VBX?

I've been given the task of re-engineering a really old VB3 application. As part of this I have an XP virtual workstation upon which I've installed VB3 Pro, so I can create a running verison of it to help me emulate it, but the VB3 app uses a control called VBSQL.VBX, which didn't come with VB3 Pro, apparently. I've checked Microsoft's site, but there are only seven pages in the search result for VBSQL.VBX, and none of them offers an install.
Does anyone here have any idea where on earth I can obtain VBSQL.VBX?
Via http://support.microsoft.com/kb/111490, "Microsoft SQL Server Programmer's Toolkit for Visual Basic".
It looks like they offer the .ocx here: http://support.microsoft.com/kb/186893, possibly there is a VBX as well?
Whenever I run into an issue like this I usually end up creating a mock object with the same public members as the class in question. Sometimes it works out better as I can fake the data I want to pass around so I can run tests that would otherwise prove difficult.
If you can't find this file this is the approach I would recommend.