C++ dll throwing assertion faliure - c#

I have a program written in C# that consumes a dll written in C++. I have the source for that but changing that is out of scope. There are two files of the type .pak and .jrn that get saved in the application. However the location of these files are configurable. If I choose to save it in a local location (somewhere on the hard drive of the machine running my C# code) it works just fine. However, when I try to configure the system to store the files in a remote machine, I get Assertion Failure error in C++.
This is really urgent. Any help will be greatly appreciated.
Thanks in advance,

I notice that you are configuring pakDir, but not jrnDir. So my guess is that jrnDir points to an invalid file path on the remote machine.

Related

Is it possible to have a Resource folder in a published C# project?

I have a question which will probably be quite vague.
I'm developing a Windows Forms application in C# that can read and write games to an Access database. Every game has an attribute that links to an Image in the resource folder.
While debugging I was able to just read and write my screenshots to the following path:
"..\\..\\Resources\\Screenshots\\";
I tried publishing my application earlier today to test if it would still work and if not, to locate the path where the Resource folder would be when published.
So far I have the feeling that the resources just get burned into the exe file or one of the other files it generates.
Is it in any way possible to have a real folder in the published version of an application from which I can keep reading and writing my images like I did while debugging?
Thanks in advance.
Yes your screenshots will be compiled into the assembly as resources when publising.
As for the real folder, you can absolutely do that. Make sure you give your app the right path to that folder.

Failed to load a dll in the Temp Directory on a Windows Server

I have developed an C# application that run very well in local.
But there is a problem when i put on the server.
The application use a DLL library (A.dll) in a point of the execution, this A.dll copy (or is create at the first execution) another DLL (B.dll) in the AppData/Local/TEMP directory. But when the A.dll try to load the B.dll an exception is threw:
system.invalidoperationexception: failed to load B.dll
I have tried to run as Administrator the main exe, but with no results. And i think that the permissions are ok, after all is the TEMP directory.
I have not access at the DLLs source, are libraries.
Anyone can suggest me any solution? Would i check better? Where?
Thank You All.
Have you checked that the system does not restrict execution of code from within the temp directory, e.g. using SRP or AppLocker?
This is usually set in group policy and is generally a sensible restriction these days to prevent things such as drive-by installers and cryptolocker malware.
You can verify this by trying to run an executable from %TEMP% and seeing if you get an access denied error.
If this is the case you can try relocating TEMP (as SRP usually defaults to locking you out of %USERPROFILE%\AppData\Local\Temp and moving the Temp folder will have the desired effect.
Hope this helps!

Replacing a dll in a SilverLight application (xap) for the purpose of sniffing traffic

I'm trying to understand how a Silverlight app communicates with its server. Communication is encrypted. I would like to see how messages look like before encryption. I came up with this idea: when browser requests the .xap file, I serve a version containing a patched DLL that does not encrypt anything. I created this DLL by patching C# code with reflexil.
What tool should I use to deliver this patched .xap file? Fiddler? Only one file needs to be replaced, all other requests from the browser should go to the original server.
Is there a simpler way of doing this? For example, does anyone know, where exactly DLL files from .xap files are extracted? How are they loaded? Perhaps it's easier to find where they get extracted and patch the already unpacked version? I used process monitor, but IE seems to be unpacking XAPs in memory.
EDIT:
I did not create the application, that's the problem. I want trick IE into loading a patched version of a DLL from the original XAP.
Don't exactly understand what you are trying to achieve, but with regards to your last question on unpacking XAPs, you can access the downloaded xap files in the following location
C:\Documents and Settings[UserName]\Local Settings\Temporary Internet Files\
rename the package to .zip instead of .xap, unzip, and access your dll there?

File.Copy fails when copying a DLL that is not in use

I've built a winforms app (C#) that will take a list of file paths, and copy those files (from a different VS solution) to a new location (In a folder the user specifies) in the same directory structure they currently exist on local file system.
I use the Path class, Directory class etc and everything works wonderfully...except when it reaches a file path that points to a DLL.
The DLLs I am trying to copy are a part of the other solution, and that solution is not currently open.
I have tried restarting computer to make sure visual studio isn't somehow hooking into that DLL even after the solution is closed.
The DLL in question can be copied by regular manual means (i.e. copy and paste shortcut).
So short of creating a batch file in the program, and running xcopy on that DLL path, I don't know of a way to get this to work.
From what I have found from google searches (which isn't much on this particular situation), File.Copy() should work..
Any help would be wonderful, even if it is a link to a duplicate question I may have over looked.
Thanks!
-The error message is: The process cannot access the file [insert file path] because it is being used by another process (The path is definitely correct also)
-Just downloaded and tried to search for the DLL name with Process Explorer.. I also ran a similar exe from command prompt to no avail. It claims nothing is using it. That's why I am utterly baffled by this. Also, I just checked the permissions and everything looks great (i.e. Full Control, owner effective permissions)
-It does not handle open files. It basically build the correct src and dest paths and does a File.Copy() on those. How would I go about handling open files? I'm sure I could figure out if it was open, but what would I do it it were open?
It is not complaining about the file you're trying to copy, it is complaining about the file that you're trying to overwrite with the copy. Lots of candidates for that, virus scanners always get very excited about new DLLs, for example. Or it is loaded into a process, the typical failure mode for trying to implement your own auto-updater.
You can rename the target file to make your copy succeed.
Are you in vista or win7? If so, Check your 'User Account Control Settings'. Sometimes this can interfere with .NET security options and prevent file operations that would otherwise work.
As well as Process Explorer, I would use Process Monitor also from Microsoft so you can see what is happening at the point of failure and allows you to see if anything else is accessing the dll.
Possible culprits are
the program you are running,
your antivirus package
a virus.
If the path it is complaining about is the destination path, then is is possible that the path is too long?
Also, when using Process Explorer, make sure you have enabled the option to show details for all processes and not just your own.
I just ran into this issue as well. I tried copying a .DLL from an FTP server to a local directory (replacing the existing one) and for the life of me I could not get it to work. Keeps giving me an 'Access Denied code: 5' Error.
I then realized that the .DLL on the FTP server was not marked as hidden while the .DLL I was trying to replace was marked as hidden.
Once I changed the local one to also be visible. I had no more issues.
So my solution is:
Make sure both files are visible.
Hope this helps someone

Question regrading which files are needed by tessnet2.dll

I made an application for an automated invoice management system for my company. I am using the tessnet2 library for OCR. The whole application works properly on my development machine but as soon as I put the code on the target machine, wihout the development framework, it gives an error of references not found in the .DoOCR method.
I read that you had the same problem and I hope you can help me with it.
I have put the language files in the same directory as the application itself, but its not helping me.
Any help or suggestions will be highly appreciated.
Thanks
Regards
Vin
Look in the VS folder (under Program Files - you'll need to look in sub-folders) for a program called "Depends". This looks for dependencies from EXE and DLL files. Run it with the DLL as a command-line parameter, and that should list what files are needed by that DLL. Then see if they are all present on the destination system.

Categories

Resources