registering a dll, in visual foxpro 7, windows 7 - dll

i have an application written in VFP 7, somewhere in the application i call a function in a dll using the following :
declare long FunctionName in DLL_NAME.dll string#, string#
.
.
.
RETURN FunctionName( StringParam1, StringParam2)
calling this function generates an error :
The following error has occurred:
Message: Cannot load 32-bit DLL d:\folder\DLL_NAME.dll.
i tried registering the dll using the 32/64 bit regsvr...no luck !
Info that could help identify the problem :
the dll file is not local, it is in a folder in a network mapped drive.
thank you very much for your help.

Aside from VFP not supporting anything 64-bit, I would look at the fact you are trying to load a dll across the network.
Eliminate that as a possible issue and copy it LOCALLY and load it from that...
Try to eliminate everything ELSE, including your VFP application. I would start directly from the VFP command window and do nothing but have a simple .prg file. In it, put nothing but the declaration and reference a LOCAL copy of the dll file. Set the values for your parameters, and then call the function.
If that doesn't work, then it doesn't matter WHERE in the application its being called... you've just eliminated that whole set of conditions and environment.
Its almost like support I offer to clients sometimes when trying to do something in our app that requests data from the internet. I have them manually go to their browser and put in whatever URL our app would be trying to go to. If they can't get to it from the browser, its something from their firewall, IP blocking, or other... it has nothing to do with our app. You might be running into a similar situation. Leave out all other elements and just get the few to absolutely test the problem isolated to itself.

I agree that the issue is likely that the dlls are located on a shared network. I have solved this problem in the past by copying the files to the local machine(s).
However, according to this article (link below), you can allow a FoxPro app (or any .exe for that matter) to use dll's from a networked drive if you add a special config file that tells the .Net framework that it's okay to access networked dlls for a certain app.
Here is the link: http://www.west-wind.com/webconnection/docs/index.htm?page=_36e0qlogr.htm

Related

Deploying an updated DLL to multiple ClickOnce manifests

I'm somewhat new to deploying ClickOnce manifests, first off. I know the basics of how to publish to an app server, which then lets every use the newest version (after setting to check for updates before running the application).
We have multiple VB.Net applications stored on our app server, that cover a lot of different areas of the company. However, all of them connect to our Oracle database in the same way. So, my thought was to create a DLL containing commonly used functions, such as decrypting and reading our connection string, among some very common SQL functions/statements that we use a lot. Then, instead of copying and pasting the same code into each .Net program, it would be stored in one place. Of course, the major benefit to this would be that if we change the method we use to connect to the database, or need functions modified/added, we don't need to open each program, paste it in, and .republish
So, I did a test where I took a program that I wrote, added the DLL to it and tested it out. It works great. Then I took the source code of the DLL, made a change to show a message box at the beginning of a function, rebuilt the DLL, and dropped it in place of the copy that was being referenced in the test program. When I run the program, it's still using the original DLL without the message box code.
My question is, how could I accomplish what I would like to do without having to republish each and every .Net program that uses this DLL whenever a change is made to it?
Option 1
Instead of publishing your dll library via click once, Put a web service wrapper around your dll class library. Each Click once application will have a reference to the web service which will run on a web server.
Your code in the dll will then be running on the web server. Any changes to the dll code will only need to be updated on the web server. You'll have to be careful to keep the interface changes to a minimum.
Option 2
push out the dll as an separate MSI install. Reference the dll in your click once apps code and make sure you don't deploy the dll with the click once install. Changes to the dll will be pushed out separately.

WCF, DLLIMPORT strange issues

I have a very strange issue that i cannot figure out.
First i have a WCF service 4.0 done in VS2010.
the service have couple methods that return string array, datatable and such.
some of them use function from C++ dll throught [dllimport]
i made a test console to test everything. when i run the WCF from visual studio and use the generated path it works wonderfully.
now here is where it become strange. if i open my local IIS create a new application and point to my VS source code the WCF i can see it perfectly.
now using the http path from IIS local instead i refresh the methods all seems correct. But when i run my test app i can call any unction without any problem EXCEPT anyone using DLLIMPORT functions. they ALL crash and cannot trace even by tracing CES exceptions.
Doing line by line logging show that the exception is really on the call of those functions
the DLL in question is the same and the path is hardcoded for my computer since still in test phase and the folder is c:\DLL\mylib.DLL so nothing to do with shadow copy IIS/visual studio do when you actually run. also DLL reference by name withotu path even if it's in sys32 doesnt work.
Any clue ?
also. 32bit, changing app pool level right access on folder, full admin on machine already too. all tried but unsuccessful.
Edit: adding to all that since i haven't made this clear, it's not my first WCF real setup. i've already made alot of services before and deployed them myself (probably somewhere around 50-60 services). I am asking because i have never seen this issue before and i tried all tricks i knew and could find on the internet and resource people i know.
We have decided to incorporate the whole service in the WPF project locally since it work as long as IIS is not hosting. but this is really not a good thing as this data and work should NOT be done on client side but instead on server side. Right now it's fine since the software that need to use this is not released to public yet so it isn't critical.
Next option will be net TCP/IP windows service hosted on the web server if i don't find anything else.
We decided to go trough the trouble of having to hard code the logic in the main software and get away from web services for this issue. we will have to deal with updating, installing unregister and re register unmanaged DLL by hand somehow but at least it works.
we have added over 5 web services since that happen and no problem with them but again none of them use DLL imports.

Print PDF from Navision Application Server

I have problem printing reports to PDF through bullzip from Navision Application Server (1) if user is not in Local Admin group (2). Only under both conditions.
In Nav code I'm doing the following: init bullzip automation object (set all parameters to suppress GUI), run report to print document to virtual bullzip printer, catch output file. Thats it. Straight as a rail.
I have two environments: Windows Server 2008 and Windows 7 (different versions of Nav, but this is changing nothing). On Windows 7 it just do nothing (but works if user is admin). On server I can see error in Event Log (translated to English)
Faulting application gui.exe, version 9.8.0.1599, time stamp 0x517126dc, faulting module USER32.dll, version 6.0.6002.18541, time stamp 0x4ec3e39f, exception code 0xc0000142, fault offset 0x0006f52f, the process ID 0x3bc, application start time 0x01ce562238369fa9.
Gui.exe is a part of bullzip.
If I run the same code from Nav Classic Client, or from the same NAS launched in command line, or under local administrator account, or if i put the NAS user in local admin group - it works just fine.
To solve this problem i need to find out one of two and how to fix it:
What is the difference between local admin and regular user that could cause application to crash in non-interactive mode (service) under regular user account.
What is the difference in running NAS as service and as command line that could cause application to crash when run as service.
What I've tried so far: extend non-interactive desktop heap, give user all local privileges that admin have in gpedit. Not works. Don't know direction for further digging.
Any alternative free pdf printers advices are welcome.
This question is still actual. Though I've managed to setup PDF printing with PDFCreator. The tough part was to let several different NAS to print simultaneously. And now the setup have a bottleneck - PDFCreator's printing queue. With bullzip automations it could be avoided.
We've had some cases where third party DLL's have crashed within NAV due to permission restrictions.
The only effective way we could narrow down the files that it was trying to access was through using Process Monitor to try narrow down what was causing permission issues.
We found a folder within System32 to do with the System's Network Profile that some DLLs use. On that note, NAS's and such should be run under a domain account.
I think re-installing the application will do that,
Just make sure you are uninstalling each bullzip and ghost script,
Now Ghost script is tricky thing, if you are installing 32 bit over 64 then you are having problem,
refer this download link download appropriate version, install it,
and then install bullzip, after downloading new version from here
this will do..
then also if any problem(if you are using application for automation, you require new com object..) refer Forum, that explains most of application interface problems..
where you need to use public class PdfSettings with namespace bioPdf.
I hope this will help ..

VB.NET Windows 7 64bit Write File in C:\Windows\System32

I'm having a massive problem trying to write a file into the c:\windows\system32 directory. The code works fine on 32 bit machines, however does not work on 64 bit machines.
My user account is an administrator on the machine, and even right clicking and choosing to run the app as administrator does not solve the issue.
When writing the file, no exception is thrown, but the file is not written.
I have read various posts regarding adding an app.manifest file containing the requestedExecutionLevel node to my solution, but as yet am unable to get this to work. I have a feeling this may be because I'm using vb.net rather than c#.net
Has anybody encountered this issue before? I'd be delighted if somebody could provide an example VS2010 VB.Net project with a correctly configured app.manifest file as I'm a little unsure whether my attempts at setting this up are correct.
(also, this is not a malicious app I am writing, I'm working on a version control app for our team and need to be able to interface with IIS files held in c:\windows\system32\inetsrv\config).
Thanks
David
Maybe the file is written under UAC Virtualization and located under C:\Users\Username\AppData\Local\VirtualStore\Windows\System32
Windows Blog - Tips on what is going on behind the scenes.
TechNet - Look under Data Redirection
Under Local Sercurity Policies there is the following option which controls UAC Virtualization.

ClickOnce Online-Only Application as a TS RemoteApp

I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the .application file for the app.
This works fine via RDP desktop session on the terminal server. As a TS RemoteApp, however, well... not so much.
I get a quick flash of command prompt (the batch file) on the client system and then... nothing...
Same goes for having it point to the .application file directly (without using a batch file) or even copying the publication locally and having it point to that.
I found a technet.microsoft.com discussion about a similar issue, but there's no resolution to it listed.
For anyone who has run into this before and got it working, what did you have to do?
We currently use RemoteApp's for everything else on that server, so I'm hoping to stick with that if possible.
The current workaround is to build and run an MSI-based installer for the app on our terminal server whenever we publish via OneClick out to the network, but this can be quite a pain at times and is easy to forget to do.
Since the app works fine via Terminal Services when run in full desktop mode but not during RemoteApp, I don't think it's anything specific to Terminal Server permissions so much as ClickOnce requiring something that isn't available when running as a RemoteApp.
The Key to getting it to work is to use Windows Explorer "C:\windows\explorer.exe". This process is the base process when you login to a full session.
If you setup the RemoteApp to use Windows Explorer and the command line argument of the path to the .application file for the ClickOnce application then it will work when launched as a remote application. Windows Explorer will flash for a second when it starts, but it will disappear then the ClickOnce application will launch.
Why does it have to be a ClickOnce application? I would consider just deploying the exe file and assemblies.
I know it only half a solution, but if the application does not change much, it might be a good solution.
I believe your problem is related to the fact that ClickOnce needs to store it's data in a special user folder called the ClickOnce application cache. Apparently because of how Terminal Services sets up user folders ClickOnce can't access this in TerminalServices mode.
See this link for more information.
http://msdn.microsoft.com/en-us/library/267k390a(VS.80).aspx
There may not be a way to do it :(
Can you launch the .exe directly? It's buried under your profile in \AppData\Local\Apps\2.0[obfuscated folders], but you should be able to find it.
That will skip the built-in update process, but if it can be launched that way you could then write code to do a manual update after the application starts.
Faced the same problem this morning and got it resolved by copying the clickonce app's directory from the user settings folder to somewhere like c:\MyApp\ - I know its nasty and not very ideal.. but good enough for me!
We recently ran across this issue and decided to post a bug report on this issue to the Visual Studio development team. Feel free to comment on the bug report. It has to be a bug in ClickOnce caused by some changes in Server 2008.
https://connect.microsoft.com/VisualStudio/feedback/details/653362/net-clickonce-deployment-not-working-as-remoteapp-or-citrix-xenapp-on-server-2008-server-2008-r2
We also have a discussion on the MSDN forums covering this issue:
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/7f41667d-287a-4157-be71-d408751358d9/#92a7e5d9-22b6-44ba-9346-ef87a3b85edc
Try using RegMon and FileMon when starting the app - You may be able to track it down to a file and/or registry permission issue.
Also maybe check the event logs to see if anything's getting logged when the process fails.