missing Axhost after using axImp.exe - axhost

I hope someone could help me out.
My original task:
I want to write a c# program that silently connects local users of a remote machine (win server 2008).
technical problem
I have found a code_project article that does exactly what I need :http://www.codeproject.com/KB/cs/RemoteDesktop_CSharpNET.aspx
However after dowloading it I saw this project referenced to AxMSTSCLib.dll (which one of his memebres is AXHost)
You have to manually create this dll. It wrapps a COM object to be used in vsual studio as a .net object.
I have used the command axImp.exe to create a AxMSTSCLib.dll:
%%\aximp.exe %windir%\system32\mstscax.dll
But there is no Axhost (checked the object browser through visual studio).
so I guess I'm creating this dll the wrong way, but I could find any other way.
here is my dll compared with the one which was donloaded from code-porject
http://drop.io/hidden/eopb4tphk8qekl/asset/Z2V0b2N4LTItanBn
http://drop.io/hidden/eopb4tphk8qekl/asset/bm8tZ2V0LW9jeDItanBn
Anyone knows why? and how can I fix that? or where should i ask this ver specific question?
Regards,
==========
Found the answer. I should have referenced an RDP monitor to the ToolBox and than the dll magically appears right.
I didn't used the ToolBox because I need no GUI. but I guess it's the only way to do this right.
I have got two more questions which I couldn't find answer to
1. Does the dll generated by drugging the RDP monitor is machine-specific?
I mean does this dll differ if created on X86 machine differs from one generated on X64 machine?
same question regarding the output of axImp.exe
Thanks

Found the answer. I should have referenced an RDP monitor to the ToolBox and than the dll magically appears right. I didn't used the ToolBox because I need no GUI. but I guess it's the only way to do this right. I have got two more questions which I couldn't find answer to 1. Does the dll generated by drugging the RDP monitor is machine-specific? I mean does this dll differ if created on X86 machine differs from one generated on X64 machine? 2. same question regarding the output of axImp.exe Thanks

Related

Formerly working Matlab Compiler-based DLL suddenly cannot initialize

Update: It turned out that there was something with installing Delphi 10.4 CE that broke my app (thanks, DelphiCoder!); specifically, it was something in the Windows Registry that was broken. After using ProcessMonitor to ensure no Delphi 10.4 (aka 21.0) was being invoked, I ended up cleaning out the registry of all 10.4 references, rebuilding completely (not clear if this was needed or not), and lo and behold, it works again! I'm adding this update in case someone in a similar situation finds this question - remember to back up your registry first and be careful!
Original Post: I created several DLLs with Matlab Compiler 10 years ago, with C wrappers, to make them available with Delphi. Once I got them working, they always worked - until today! The code in the C wrapper initialization function in question is in the code box below; the "Could not initialize library" is printed to the console when I run my Delphi app.
mclmcrInitialize();
if (!mclInitializeApplication(NULL, 0)) {
fprintf(stderr, "Could not initialize application\n");
}
if (!libMyDllInitialize()) {
fprintf(stderr, "Could not initialize library\n");
}
The problem is that this has never happened before, over all the probably 10 years since we first wrote these! My machine has the correct version of the 32-bit 2021a MCR installed, as it has for several years; I've installed this on numerous machines from Windows XP up to Windows 10, The DLLs were last built 5 - 7 years ago; anyway, I don't have access to the Matlab compiler anymore. The only thing that has changed is my app, but not anywhere near where this DLL initialization code is called; also, when the problem first happened, my app was working, then didn't -without any changes. Finally, I went back a few days and rebuilt my app, and it still fails.
So I am really stuck, and need some advanced help in debugging DLL startup issues on Windows. I tried looking in the Windows Event Logger, but nothing appears to show up there. Logs to check? A setting in the Registry that somehow got hosed? Wrong phase of the moon? How does one debug loading/initializing a formerly working DLL when forced to treat it as a black box? Help!
How does one debug loading/initializing a formerly working DLL [...]?
I think there is no definitive answer to your question.
This is how we have gone about debugging the loading/initializing of DLLs and applications and may help you:
We regularly work with systems where we have no source code for the DLLs (and often we don't have any source code for the applications either). We experience DLL conflicts quite regularly. When testing why applications don't start as expected we have found the use of Sysinternal's Process Monitor by Mark Russinovich invaluable.
This will show you system level activity. You can filter for your process and then you will see all file, registry, thread and network activity (although thread and network are quite limited). If the DLL has dependencies then the system tries to find those and so you will be able to discover all dependent DLLs and COM interfaces (by seeing the registry lookups for that interface) that it's looking for. Process Monitor will show if the resource is not found or if access is denied.
Slightly more difficult to discover is if one of the dependencies exists but the export table has changed (so the functions have different signatures or export ordinals). There are ways to check that (by looking at the export and import tables) but generally (if you have access to a working environment) it's enough to check the filesize, timestamp (and the VERSIONINFO resource if there is one) between DLLs.

NDIS driver - how?

I have read nearly all of the material on Microsoft's MSDN site, used Google (for the limited information that is out there) and also looked at the answers on here but I'm still confused on how to develop a NDIS driver.
My aim is to create a ndis driver so I can capture the network packets and decide whether I want to drop them (possibly inject as well) or allow them to pass.
From my research it would seem that I need to create an intermediate NIDS driver and after installing WDK (I'm using Visual Studio 2015 enterprise) I don't know where to begin (do I need to start with a KMDF project?).
Also, when I did load a KMDF driver project nearly all of the header files are getting highlighted by Intellisense as having errors (expected an identifier, NTSTATUS is underefined)?
Can anyone give some assistance on how to start please?
I have recently created a packet sniffer using the WinPcap library (and also used it to send packets) but there was a lot of information out there that helped me. Unfortunately, with NDIS it doesn't seem to be the same.
I can't seem to find the samples either
Okay, so a simple clean install of Visual Studio 2015 and WDK 10 is all that is needed to set up the environment for creating a driver.....
But then comes the deployment part

Is there a way to find the Delphi compiler version?

I try to find programmatically the version of Delphi compiler(s) installed on my machine.
I'm looking in the registry but without success. I'm using Windows 7-64bits Professional
You can inspect the registry. Look under these keys:
HKLM\Software\Borland\Delphi
HKLM\Software\CodeGear\BDS
HKLM\Software\Embarcadero\BDS
Under each of those keys you will find subkeys with a version number. For example, Delphi 6 is:
HKLM\Software\Borland\Delphi\6.0
Delphi 2010 is:
HKLM\Software\CodeGear\BDS\7.0
Delphi XE5 is:
HKLM\Software\Embarcadero\BDS\12.0
Note that this will not guarantee that the installations are in fully working order, mind you.
Also be sure to look in the 32 bit registry view if you are on a 64 bit machine. The registry redirector will take care of that for you if your process is a 32 bit process. But you might get confused when looking under regedit. When viewing in regedit these keys become
HKLM\Software\Wow6432Node\...
#RRUZ has a nice post about this here: http://theroadtodelphi.wordpress.com/2010/10/27/detecting-installed-delphi-versions/
I believe you can take any open-source library having the installer. That already was solved in it one way or another. And you can re-use already tred and tested solution instead of wasting your time on NIH-approach.
For example, you may take JEDI CodeLib and look into jcl\source\common\JclIDEUtils.pas
http://JCL.sf.net
http://github.com/project-jedi/jcl
And the practical example of yousage those functions is the installer itself: jcl\install\JediInstaller.dpr

How to migrate Delphi or clone Delphi registry settings?

I have two PCs both with XE2. I thought that I had installed identically on both but have problems installing 3rd party packages on one while the other is just fine.
I want the same on both anyway. The easist would probably just to "migrate" the working set-up by moving in into my Dropbox folder. Can I do that? If so, how?
If not, can I (easilly) backup my registry settings on one machine and then import them on the other?
I suppose I could just sort out the problem on the one PC, but am not having much luck so far. I would rather invest the time in only having one Delphi setup. And since I am moving lots of other stuff to DropBox anyway ...
The tool for this is now built into Delphi XE8 and higher.
It's found here:
C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\migrationtool.exe
Online documentation:
http://docwiki.embarcadero.com/RADStudio/Rio/en/Settings_Migration_Tool
Install CnPack wizards from http://www.cnpack.org
From the CnPack toolbar select IDE Config Backup/Restore (image below) and save this file somewhere safe
Copy the components to the second delphi machine . Keep the exact same directory structure.
I store my components as follows this helps backing up, moving etc., but you can use your own structure
D:\components_bds\DCU
D:\components_bds\BPL
D:\components_bds\ComponentsThemselves
Use the restore config file from CnPack to restore your components on the new machine
This is also useful if your testing components that you plan to remove later and keeping a backup of your installation incase something goes wrong you can save time with new delphi installation if hard drive dies. Keep a copy on flashdrive or somewhere safe
You may compare/diff the config file created by cnPack using a tool like Beyond Compare and see what the differences are to find out why third party components give problems on one of the machines. It may be a Delphi registry/installation problem or a problem in the paths of the thirdparty components. Components need to be installed in an order perhaps it did not find the needed dcu or dll it depends on.
I don't know of any way to do so with DropBox. Here's an old post I made (related to Delphi 7, but with correction of registry keys still applicable) in the CodeGear newsgroups; hopefully it will help.
(It probably goes without saying, but back up the existing registry settings on the destination machine before starting by using RegEdit and exporting them, just in case. You'll at least be able to get back to the point you're at now if something goes wrong by deleting the imported entries and then importing the saved ones.)
You can't, without some difficulty anyway. (Especially if you have
third party components installed, as they may have placed files in the
%SYSTEM% folder you may not know about.)
You may be able to (for going from the old computer to the new
computer running the same exact version of Windows!) by exporting the
registry keys under HKCU\Software\Embarcadero and
HKLM\Software\Embarcadero from the old machine, and then after
installing Delphi on the new machine (in the exact same folder
location) importing that registry file.
Many of the compiler, linker, and other settings are configured on a
per-project basis, and should transfer over when you move your source
code to the new machine.
Third-party components are a problem, as I mentioned above. You may be
able to get away with using the registry export/import if you copy
each third-party component set from the old computer into exactly
the same location on the new machine before importing the registry
file. You'll probably have to track down some .BPL files that end up
in the $(BDS)\Bin and possibly other folders under the $(BDS)
tree; the IDE will tell you about missing stuff when you try and start
it. Make sure you answer "Yes " when asked if you want to try and load
it again next time!
Most of my development is hobby stuff or wannabe releases. Instead of dying trying to move my XE2 Pro from my Dell Inspiron N7110 Win 7 machine to my new Win 10 SSD machine, I'm seriously thinking of switching to Lazarus. I've used Lazarus 2.x with Indy 10, ZeosLib, and Firebird and successfully created a working distributed internet system. I also created Lazarus version of my XE2 Blackjack program. When compared to XE2, Lazarus (IMO) has only two weakness and neither are deal breakers for me. BTW, I have successfully duplicated Lazarus (with all installed components) from one machine to another simply by copying and pasting the Lazarus directory and it works. Try that with Delphi.
Sam

Building Installation Disk for My Delphi 2010 Application

Can someone please give me a step by step on how to build an installation disk for my Delphi 2010 application?
I have tried both InstallAware Express Edition which comes with Delphi 2010 but keeps on giving me error message for it continue to look for *120.bpl instead of *140.bpl
I have also tried InnoSetup with ISTool but fail to work, which I believe I am not setting it up properly.... (e.g. failed to include all required packages)
My Apps is a simple database enquiry which I used dbExpress to connect to my ms-sql database.
I have also tried switching the flag in Delphi 2010 for "Built with Packages", no luck also...
Please help....
I am leaning toward using InnoSetup instead, but can someone tell me what is the typical set up is like... much appreciated.
Cheers.
The best place for support on an innosetup script, is the innosetup newsgroups. If you ask your question there, they would want to know more detail about what you are trying to do. Your app is going to set up some database stuff, so a lot more detail is required if you want an answer.
Innosetup is definitely is the easiest and fastest route to a setup.exe, which when placed on a CD, would make an "install CD". (Who uses CDs anymore anyways?)
In Thunderbird/OutlookExpress/WindowsMail, add an nntp server called news.jrsoftware.org,
and subscribe to the newsgroup "Jrsoftware.innosetup.code" and "jrsoftware.innosetup", and ask your question. Post your script. Show your error messages. Explain your database configuration strings, and how you are installing any dbExpress runtime components, if any apply to your application.
dbexpress in Delphi 2010 don't need nothing to be registered when deployed.
You simply need to create a folder with:
your executable.
all the required packages.
libmysql.dll
dbxmys.dll
midas.dll (if you are not using midaslib in your uses clause)
This is a easy work for an installer.
We've used Wise Installation for many years. Very easy to build install scripts. Works great.

Resources