Hey everybody,
I have the following problem: there is a device working Windows CE 6.0 and having Compact Framework 2.0 installed.
There is a file on the flash disk in this device and I need to make a copy of this file with other name.
When I'm calling File.Copy(oldName, newName, true) it throws UnauthorizedAccessException if the file with new name already exists.
What does it mean ? At that time this file can be successfully deleted by File.Delete(newName).
Everything works good under CE 5.0.
Thanks,
Alexey
One detail: the existing file has HIDDEN attribute.
The same happens when I'm using Win32 API. CopyFile(oldName, newName, FALSE) fails and GetLastError() returns 5 - access is denied.
I have an experimental device, so is it a new feature of Win CE 6.0 or it is a device's bug ?
Thanks,
Alexey
Related
My goal is to get the TCP data from a TCP application on the pocket pc
like data from internet explorer or active sync. I want to write a proxy
that forwards all TCP data to the application server (Web server,...).
So I have tried to replace the ws2.dll with a wrapper dll that forwards all
winsock API calls to the original ws2.dll. But when I replace the ws2.dll file
with my own and make a softreset the device hangs in boot screen and
I must do a hardreset. Could not get this to work on WM5 but it works great
on WM2003 devices.
So I have tried another thing. Have heard about API hooking and want to
try this with winsock API functions (connect, WSAConnect, send, recv,...).
After several days of investigation in some forums I have found many
informations about API hooking and API sets win WM5. But when I look
deeper there is no server process for winsock API calls. So I cannot
change the method adresses.
Another idea was to hook LoadLibrary() API function and when ws2.dll is
loaded from an application I will load my own dll and forward all calls to
the original ws2.dll. But LoadLibrary() has also no server process.
Has anybody another idea how to do this?
Thanks for any information on this.
Houser
Hi Houser!
I think the reason your original method failed on WM5 is because all system DLLs must be signed or the system will not load them.
There are several threads on this forum (sorry, can't remember precise link right now) that explain how to create\use certificates, and sign files, so just search for that.
Good luck.
Thanks levenum for your reply.
I also have thought about signing the dll but I have disabled certificate
check on the WM5 device with the Cert_SPCS.CAB file and now
my system loads every dll without asking the user.
I have written some test applications that explicite load my ws2.dll with
a different name (ws2xx.dll) and then in my ws2xx.dll I load
the org ws2.dll from \windows dir and all worked fine. I can use
any winsock function and can make TCP connects and so on.
So I think signing is not the problem, only when I do not use
the Cert_SPCS.CAB file to disable it?
Or are system file always checked at boot phase?
That would then explain the problem maybe.
Regards
Houser
I am pretty sure system files are treated separately. I once used a device with no cert ROM, which ran all programs and loaded DLLs without asking for certificate, but refused to do so for system files (MUIs).
I think you should give certificates a chance before moving on to more complicated solutions.
So I should try to sign my wrapper dll with a certificate.
So I will try to sign with the Visual Studio 2005 developer
certificate. And then I must install this certificate on my device
so that the system trusted the dll file with this certificate?
Houser
Another thing: What do you mean with MUIs?
That's correct.
There are provisioning CABs in the 2005 SDK. You just run them on your device and they insert all the test certificates.
SDK also shows how to provision devices through RAPI, but most WM5 ROMs block that option.
Also you should use the 'privileged' execution certificate to make sure you have maximum access to the system.
MUIs are duplicate system DLLs that contain resources for other languages. For example: coredll.dll.0409.mui will contain English resources for coredll.dll (409 is hex for English code page). They are used to switch interface languages both on PC windows and mobile. (Metalanguage User Interface).
P.S.
If you want, there are XML templates for provisioning CABs in the SDK, and makecert.exe that let you create your own certificate and put it on the device.
Another thing: What do you mean with MUIs?
So I have tried this:
1) Installed the SdkCerts.cab certificates on the device (copied the file on
the ppc and tap in explorer on it) A success message was displayed from
the setup process.
2) In VS2005 I have set in the project settings the cert signing to "Sample
Privileged Root for windows mobile SDK" certificate and rebuild my dll.
In the dll file properties I can see the certificate.
3) Have copied my ws2.dll file to \windows and replaced the org ws2.dll file
there, my dll loads a copy of the org ws2.dll (ws2copy.dll) that is also
in the \windows dir
4) Then the big moment: Soft reset and..... hanging again in boot screen
The installed certificates did not appear in the pocket pc certificate manager.
Do you know if they should appear there or not?
Maybe the SDK certificates are not imported correctly?
Thanks for you help!
Houser
I'm sorry my solution didn't help.
The test certificates do not show in the list (don't know why).
The way I see it there are two possibilities:
1. I was wrong about the certificates. (Though I think you may still need them)
2. There might be a problem with the copy DLL you try to load (ws2copy.dll). Is it from a good dump? Have you tried loading it from a test app? Is it signed? I think it needs to be signed to.
Sorry I can't give you advice on an alternate way. Insufficient knowledge...
It is very frustrating, I do not knwo how many
hard resets I have made in the last few weeks. :?
I have written a test app that loads my winsock dll file and
then my dll loads the copy ws2.dll file. The copy ws2.dll file
is from a platform builder 5.0 build.
These tests with my test app all worked fine, I can make TCP connects
and do all the winsock stuff like I load the org ws2.dll file directly.
I have even disabled certificate check on the device and tested
with unsigned dll and it works too.
The copy dll from PB 5.0 is not signed. may be this could
be a problem when my dll is loaded in boot time.
Do you know a way to sign the copy PB dll with the SDK certificate?
Thanks man!
Houser
Signing files (DLL, EXE, CAB) is very easy. In the SDK, there is a file called signcode.exe. It will give you a step by step wizard to sign the file. The only additional thing you will need is the certificate files themselves which should also be in the SDK.
Got it to work with signing the copy dll file and
now after soft reset my device does NOT hang. :lol:
Many thanks for your support levenum!
That is very good but now I have figured out that
I cannot make a localhost connect on a local tcp port
on the device. That has something to do with WM5
because it was working under Wm2003. Strange..very
strange.
Houser
Hello,
Please correct me:
i am new and i think i can compile .NET2 Applications.
Installing .NET Runtime on Mobile Device
1)I installed the .NET Compact FrameWork Runtime on My Magican. Ok no Problem
2)I moved it to Card (registry modification) to save MainMemory
3) Copy all Stuff GAC to My PC in a Folder eg. "DLLs"
Install .NET 2.0 Framework SDK
4) I found it on SharpDevelop 2.0 .NET
5) Create a batch to compile
-----------------------
set path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
csc /noconfig /nostdlib /r:GAC_mscorlib_v2_0_0_0_cneutral_1.dll /r:GAC_System.Drawing_v2_0_0_0_cneutral_1.dll /r:GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll /r:GAC_System_v2_0_0_0_cneutral_1.dll /r:GAC_CustomMarshalers_v2_0_0_0_cneutral_1.dll /target:winexe /out:test.exe /r:GAC_Microsoft.WindowsCE.Forms_v2_0_0_0_cneutral_1.dll hallo.cs
pause
And the hello.cs...
sing System;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
namespace MsgWindow
{
public class MessageWindowForm : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
// Create an instance of MsgWindow, a derived MessageWindow class.
MsgWindow MsgWin;
public MessageWindowForm().....................................
--------------------
And copy the test.exe to Mobile device and it work....
Is there any failiure on my doing? And why do i need extra Packages SDK for mobile devices?
I whant to change something in that mui file but when i open it with resourche editor i see something like (\0x00) or (000)
after some words..
When i edit this words i can't put buck those 000
Example :
22372, "1\0x00"
22373, "2abc\0x00"
22374, "3def\0x00"
22375, "4ghi\0x00"
Also i have Microsoft Visual Studio 2005 & Pocket PC SDK.
In Microsoft Visual Studio 2005 doesn't show those 000, but if i edit with Microsoft Visual Studio 2005 when i go to sign the file give's me error.
Error: Signing Failed. Result = 80070057, (-2147024809)
Click to expand...
Click to collapse
Please any one to know something about that tell me...
Thank's for your time.
Never ever ever use VS to edit resources! It screws up dialog templates and makes MUIs unusable.
The only good way to edit an MUI is Platform Builder. You can download a free evaluation version that will run for 180 days, but even with most options striped on installation it is still around 1GB.
Hope you have a good internet connection.
what version of Platform builder i need to edit mui files from WM 2003 ?
i see difrent version like: 5, 4.2 and other
but i dont know what chose
levenum said:
Never ever ever use VS to edit resources! It screws up dialog templates and makes MUIs unusable.
The only good way to edit an MUI is Platform Builder. You can download a free evaluation version that will run for 180 days, but even with most options striped on installation it is still around 1GB.
Hope you have a good internet connection.
Click to expand...
Click to collapse
Thank's Levenum ...
I sucesfull download the Windows Embedded CE 6.0 Evaluation Edition but it is say This download is a plug-in for Visual Studio 2005 ...
So what i 'm doing??
I nead the Windows Embedded CE 5.0 ??
I also download the 5 version but at the end give one error and say something like:
the download file have been interuptut before the installation finish...
So what can i do and what for those two version i have to download and if you know how can resolve the error problem on version 5??
Sorry for
&
Many many thank's Levenum
Ok i download and install the platform builder 5.0 but when i load the mui file after do my change's and go to save it he say me:
''Cannot save the file.
Cannot load a resource from the executable.''
So what i'm doing wrong??
Thank's adn sorry again....
I explained this in a PM, but just in case others are interested:
Possible causes are:
1) MUI was signed when you edited it.
2) MUI was extracted using WM5test tool by mamiac. (This tool is excellent for dumping ROMs for viewing but files can not be used on the device)
3) PB sometimes does that for no apparent reason (at least to me)
Get another DLL one that is not signed or dumped from device, delete any resources it has and put the resources from the MUI in it. Then save and rename.
levenum said:
I explained this in a PM, but just in case others are interested:
Possible causes are:
1) MUI was signed when you edited it.
2) MUI was extracted using WM5test tool by mamiac. (This tool is excellent for dumping ROMs for viewing but files can not be used on the device)
3) PB sometimes does that for no apparent reason (at least to me)
Get another DLL one that is not signed or dumped from device, delete any resources it has and put the resources from the MUI in it. Then save and rename.
Click to expand...
Click to collapse
Thank's for your help again Levenum but doesn't work.
I try tu build one new .dll but when i put one string (for test) after i try to save but give's me the same error.
''Cannot save the file.
Cannot load a resource from the executable.''
What else can i do ???
Please help me..
I try weeks now to edit five lines
Thank's and sorry...
Sorry, but now I am stomped. I never had PB fail to save a single string to a new 'clean' DLL.
Any chance there is some kind of access problem to the actual location where the file resides? Could it be 'read only' or under restricted permission?
This is really strange...
VipMSCRexe is a utility to run MortScript without Assigning .mscr extension to MortScriptexe.
How to Use it
Rename exe to your scriptname.exe e.g if your script name is sashimi.mscr then rename this VipMSCRexe.exe to sashimi.exe
This utility will first find MortScript.exe in Current directory and Sub directory under it
if not found then look in \Program Files and sub directory
if still not found then look in \Storage Card\Program Files
if still not found then look in root directory.
Once MortScript.exe found then find <exename>.mscr in same above fashion.
Once script found then execute command like MortScript.exe scriptname.mscr parameter1 parameter2 etc.
Advantages of this Utility
you can have only one installation of MortScript and may be all your script in one another folder.
Now if you want to call any of script copy this exe and rename to your scriptname.exe
Basically if you have script name sashimi.mscr then copy this exe and rename to sashimi.exe and put it in any folder
Root or storage card any where and run exe will execute your script you do not give any path or tell where it located etc.
To me MortScript.exe only support one parameter where as this Utility support multiple parameter
Version 1.0
Initial version
Version 2.0
Make changes so that Arguments are passed properly
Performance Improvement using config file
Version 3.0
Performance and Special Chars Handling in Mortscript's Path
Version 5.0
Performance improvement Using registry values
Version 6.0
Fixed Langeuge issue
Fixed Error Handling Routine
Very interesting. I have several uses for this right away so I'll download it and test. Many thanks for sharing!
Just want to note that although this is a fine tool (I'm using it for SASHIMI), if you DON'T need to pass parameters to your program you would be better off to use a renamed Autorun.exe file from the MortScript download.
The only reason I say this is becuase of the delay that VipMSCRexe has when locating/opening the script.
But, if you need to pass parameters to your script, this is the tool!
Don't work in my PC "System.ArgumentException: URI formats are not supported"
In smartphone with WM6.1 is the same error
hurtavy said:
Don't work in my PC "System.ArgumentException: URI formats are not supported"
In smartphone with WM6.1 is the same error
Click to expand...
Click to collapse
Don't work in my PC "System.ArgumentException: URI formats are not supported"
Only Supported for Pocket PC's not for desktops
In smartphone with WM6.1 is the same error
SmartPhone and WM6.1 I am not sure you have smartphone or Wm6.1
Can you please let me know which phone you have?
I have Motorola MPx200 with WM6.1 Standart Russian.
Error message is in russian language. Translate:
System.ArgumentException: It is not possible to show the error message, since it is impossible to find its containing additional assembling of resources in System.IOath:InternalCombine()...
Do you have .netCf 3.0 installed?
hurtavy said:
I have Motorola MPx200 with WM6.1 Standart Russian.
Error message is in russian language. Translate:
System.ArgumentException: It is not possible to show the error message, since it is impossible to find its containing additional assembling of resources in System.IOath:InternalCombine()...
Click to expand...
Click to collapse
Do you have .netCf 3.0 installed?
v3patel said:
Do you have .netCf 3.0 installed?
Click to expand...
Click to collapse
No. Only .NETcf 2.0
I do not have smartphone to test but can you try changing your languegue to english and then try. I just want to see is it languege problem or somthing else.
Posted Version 6.0
Posted Version 6.0
v3patel said:
Posted Version 6.0
Click to expand...
Click to collapse
You Can make it run in Win-CE ?
Great App.
But I have a same problem, it delayed 3-4 second before running a script.
Hope that you can fix it!
Thank u.
blue1311218 said:
Great App.
But I have a same problem, it delayed 3-4 second before running a script.
Hope that you can fix it!
Thank u.
Click to expand...
Click to collapse
Me too, I know that you may have heavy code inside to do like path checking & etc., may be another version with just execute the .mscr in same folder as MortScript.exe & <VipMSCRexe>.exe ?
Many thanks for this great app.,
Thanks, that the thing I need~~~
Hope you can me help
Hello,
i have program in the startup of my WinCE 5 Falk GPS. After the Hard Reset, has a Error. And the text:
Script \Temp\0084Script.mscr not found, waiting for existence (Storage Card not Initializied?)... After 3 sec. my falk stops.
Sry for bad english, im german.....
Urgently need FakeGPS.DLL and/or FakeGPS.CAB from Windows Mobile 6 SDK (couldn't extract it myself with MSI Extractor form the .MSI file I downloaded from MS).
TIA
The attached file is the zipped contents of :-
C:\Program Files\Windows Mobile 6 SDK\Tools\GPS
It contains:-
FakeGPS.CAB
FakeGPSReadme.txt
Settings.exe
SettingsReadme.txt
The CAB is 1,793Kb
These files also appear in the 6.5.3 DTK, but they seem to be the same files, (size etc.)
Thanks for helping. Now I could extend a project of mines (installing the necessary fake GPSID in WinCE is omitted next):
Code:
If(DeviceEmulator)
// Install FakeGPS
// Fake GPS enables to receive data using the GPS APIs even if there is no GPS receiver on the device.
// The GPS data is read from NMEA .txt files that reside in \Program Files\FakeGPS\GPSFiles.
If(DirExists(MyFolder\"FakeGPS"))
If(NOT DirExists("\Program Files\FakeGPS"))
MkDir("\Program Files\FakeGPS")
XCopy(MyFolder\"FakeGPS\Program Files\*.*","\Program Files",1)
CreateShortcut("\Windows\StartUp\FakeGPS.lnk","\Program Files\FakeGPS\FakeGPS.exe")
// Restart emulator
Reset
EndIf
EndIf
EndIf
Thanks again.
You are more than welcome.
Fortunately I keep an old laptop running 32 bit XP, just so I can run the emulator images and earlier versions of Visual Studio on it. It even has Embedded Visual C++ 3.0 and 4.0.
None of these will run properly under 64 bit Windows 7. Under an XP virtual machine is not a solution either. Virtual machines under virtual machines? Nope!