Found some unlocking application for ZTE K3571-Z (and may be some others ZTE, HUAWEI, etc.) modems. Seemed to work for me...
Get it there.
You'll have to register on forum to get download link (I don't want to steal credits for it)...
Sunday, November 28, 2010
Sunday, June 20, 2010
.net 1.1 (vs2003) applications on Windows 7 x64
I needed to create a demo application (LARGE one) built with Net 1.1 Framework for demonstration on Windows 7 x64 computers (it was just easier than prepare a Net 3.5 version). I've met several problems this way, may be some one will find this information useful:
1. Windows 7 misses C-Runtime components for Vs2003, I mean MSVCR71.DLL file. If your program is using it, you should redistribute it (and place it in your program binaries directory or into System32 (for x86 windows) / SysWow64 (for x64).
2. Emulation (or backward compatibility) of 1.1 framework works fine withing Windows 7 (framework 3.5sp1 integrated), beside one particular moment: NativeOverlapped object. Type of EventHandle field of this object was SILENTLY changed from int to IntPtr in move from Framework 1.1 to 2.0. This is very funny, since now any 1.1 programs using this object won't work at frameworks >=2.0 at all, with error looking like "Unhandled AppDomain Exception (CLR is terminating: True): System.MissingFieldException: Field not found: 'System.Threading.NativeOverlapped.EventHandle'.".
I don't know how you can help yourself if you haven't got source codes of net 1.1 application, otherwise the solution is simple: replace all direct accesses to this (EventHandle) field with indirect one, like this:
Considering this declarations
NativeOverlapped addrChangeOverlapped = new NativeOverlapped();
ManualResetEvent addrChangeEvent = new ManualResetEvent(false);
It was (in our application):
addrChangeOverlapped.EventHandle = addrChangeEvent.Handle.ToInt32();
It become (in version compatible for execution with net 3.5):
IntPtr aceHandle = addrChangeEvent.Handle;
FieldInfo aceFI = typeof(NativeOverlapped).GetField("EventHandle");
aceFI.SetValue(addrChangeOverlapped,
aceFI.FieldType == typeof(int)?(object)aceHandle.ToInt32():aceHandle);
1. Windows 7 misses C-Runtime components for Vs2003, I mean MSVCR71.DLL file. If your program is using it, you should redistribute it (and place it in your program binaries directory or into System32 (for x86 windows) / SysWow64 (for x64).
2. Emulation (or backward compatibility) of 1.1 framework works fine withing Windows 7 (framework 3.5sp1 integrated), beside one particular moment: NativeOverlapped object. Type of EventHandle field of this object was SILENTLY changed from int to IntPtr in move from Framework 1.1 to 2.0. This is very funny, since now any 1.1 programs using this object won't work at frameworks >=2.0 at all, with error looking like "Unhandled AppDomain Exception (CLR is terminating: True): System.MissingFieldException: Field not found: 'System.Threading.NativeOverlapped.EventHandle'.".
I don't know how you can help yourself if you haven't got source codes of net 1.1 application, otherwise the solution is simple: replace all direct accesses to this (EventHandle) field with indirect one, like this:
Considering this declarations
NativeOverlapped addrChangeOverlapped = new NativeOverlapped();
ManualResetEvent addrChangeEvent = new ManualResetEvent(false);
It was (in our application):
addrChangeOverlapped.EventHandle = addrChangeEvent.Handle.ToInt32();
It become (in version compatible for execution with net 3.5):
IntPtr aceHandle = addrChangeEvent.Handle;
FieldInfo aceFI = typeof(NativeOverlapped).GetField("EventHandle");
aceFI.SetValue(addrChangeOverlapped,
aceFI.FieldType == typeof(int)?(object)aceHandle.ToInt32():aceHandle);
Saturday, March 6, 2010
svn and eol-style on Windows
Recently I had problems with one great tool - Resharper. Behaviour of this VS 2008 plugin in this particular situation wasn't perfect (showing boxes instead of text lines :), but it was easier to fix problem at our side than wait for resolution by developers.
Resharper doesn't like unix style (LF) or mixed style (somewhere LF, somewhere CRLF) EOLs (end of line-s). And our big solution had many C# source files with wrong (for windows platform) EOLs. So sometimes in some files refactoring or even just working with Resharper enabled was impossible.
I'm not sure about specific situation when our EOL's become damaged, but most likely this ocurred during migration from CVS to SVN. SVN contains built-in property to fix this problem (svn:eol-style set to native), so we only needed to:
1. Set autoproperties (most our developers are using tortoisesvn so it was easier for us to set tsvn:autoprops property one time for solution root, efficiently enabling autoproperties for all our working copies) to enable svn:eol-style option for all files added in future. So we set tsvn:autoprops property for project root to this value:
Resharper doesn't like unix style (LF) or mixed style (somewhere LF, somewhere CRLF) EOLs (end of line-s). And our big solution had many C# source files with wrong (for windows platform) EOLs. So sometimes in some files refactoring or even just working with Resharper enabled was impossible.
I'm not sure about specific situation when our EOL's become damaged, but most likely this ocurred during migration from CVS to SVN. SVN contains built-in property to fix this problem (svn:eol-style set to native), so we only needed to:
1. Set autoproperties (most our developers are using tortoisesvn so it was easier for us to set tsvn:autoprops property one time for solution root, efficiently enabling autoproperties for all our working copies) to enable svn:eol-style option for all files added in future. So we set tsvn:autoprops property for project root to this value:
*.c = svn:eol-style=native2. Set svn:eol-style property for files already present at SVN repository. This was a tricky one (at least under windows), cause we needed to recurse all solution folders searching for .CS files, fix EOLs in them (otherwise svn won't accept eol-style property for these files), and set property. Ok, to make the script bellow work you'll need some client SVN binaries (I'd used sliksvn) and this my small regex processing tool (requires .Net 3.5sp1). Ok, contents of BAT file (I named it svnps.bat):
*.h = svn:eol-style=native
*.cpp = svn:eol-style=native
*.cs = svn:eol-style=native
*.strings = svn:eol-style=native
*.resx = svn:eol-style=native
*.csproj = svn:eol-style=native
*.sln = svn:eol-style=native
*.sql = svn:eol-style=native
*.config = svn:eol-style=native
*.build = svn:eol-style=native
*.tpl = svn:eol-style=native
@echo offPlace this bat file and RegExRun.exe to Program Files / Sliksvn / bin directory, go with command prompt (or FAR for example) to your SVN repository directory and run something like this:
for /R %%a IN (%1) DO (
echo ---- processing %%a
RegExRun.exe "(\r\n|\r|\n)" "\r\n" < "%%a" > "%%a.crlf"
rename "%%a" "%%~nxa.old"
rename "%%a.crlf" "%%~nxa"
del /F /Q "%%a.old"
"C:\Program Files\SlikSvn\bin\svn.exe" ps svn:eol-style native "%%a"
)
"C:\Program Files\SlikSvn\bin\svnps.bat" *.csThis will fix all non DOS (non Windows) EOLs in .CS files in current path (recursively) and set svn:eol-style=native for each of them. Together with autoproperties that should resolve all your (and our) problems :)
Friday, March 5, 2010
Beware of SHFileOperation
Take care in case you ever going to use SHFileOperation function.
Fields pFrom and pTo of SHFILEOPSTRUCT must be double-null terminated!
Even if you are passing only one file name.
P.s. Our tech.support guys informed me about funny thing: last version of one of our products distributed to clients was removing boot.ini, ntldr, and other files at C:\ during uninstall. Yes, due to missing second null. Evil :)
Fields pFrom and pTo of SHFILEOPSTRUCT must be double-null terminated!
Even if you are passing only one file name.
P.s. Our tech.support guys informed me about funny thing: last version of one of our products distributed to clients was removing boot.ini, ntldr, and other files at C:\ during uninstall. Yes, due to missing second null. Evil :)
Saturday, February 13, 2010
Visual Studio 2008 failed to start
One funny problem just happened with my computer for the second time in half-a-year.
Visual Studio 2008 (MS VS2008 SP1 with ATL fixes) suddenly refused to run and displayed the following problem: "Cannot find one or more components. Please reinstall the application".
This thread contains the detailed desciption of the problem and similar user stories: http://social.msdn.microsoft.com/Forums/en/vssetup/thread/76713427-0daa-4907-a017-633ad258a5af
It actually helped me very much to resolve this problem for the first and second times.
The second time it was the same file, but I still don't know what kind of software/installation removed it.
WinSxS\x86_Microsoft.VC90.ATL_1fc8b3b9a1e18e3b_9.0.30729.4148_x-ww_353599c2\ATL90.DLL
The easiest way to restore it is to download and install vcredist_x86 (redistributable for Visual C++ 2008 SP1 with ATL security update) from here (if your computer is missing the same file):
http://www.microsoft.com/downloads/details.aspx?familyid=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C&displaylang=en
I wouldn't recommend copying atl90.dll from any x86 directory inside WinSxS since they all different versions, and this one actually contains some security fixes.
P.S. You need to start profiling (F7) in depends (Dependancy Walker, rocks!) to see which dlls are really required and missing on your system.
Visual Studio 2008 (MS VS2008 SP1 with ATL fixes) suddenly refused to run and displayed the following problem: "Cannot find one or more components. Please reinstall the application".
This thread contains the detailed desciption of the problem and similar user stories: http://social.msdn.microsoft.com/Forums/en/vssetup/thread/76713427-0daa-4907-a017-633ad258a5af
It actually helped me very much to resolve this problem for the first and second times.
The second time it was the same file, but I still don't know what kind of software/installation removed it.
WinSxS\x86_Microsoft.VC90.ATL_1fc8b3b9a1e18e3b_9.0.30729.4148_x-ww_353599c2\ATL90.DLL
The easiest way to restore it is to download and install vcredist_x86 (redistributable for Visual C++ 2008 SP1 with ATL security update) from here (if your computer is missing the same file):
http://www.microsoft.com/downloads/details.aspx?familyid=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C&displaylang=en
I wouldn't recommend copying atl90.dll from any x86 directory inside WinSxS since they all different versions, and this one actually contains some security fixes.
P.S. You need to start profiling (F7) in depends (Dependancy Walker, rocks!) to see which dlls are really required and missing on your system.
Tuesday, February 2, 2010
Mikrotik RouterOS and domain (active directory) DNS requests forwarding
I'm using mikrotik router at home, with RB150 constantly handling connection to provider (PPPoE) and to my office (VPN over internet).
However since router is using provider's DNS, it is not possible to work with shared folders or perform any other domain tasks (while office IPs are readily accessible). Anything using active directory will fail, since any computer in home won't be able to resolve domain controllers.
How to fix this:
1. added layer7 matcher for \x06\x5Fmsdcs\x08mydomain\x03com
(you need to replace mydomain.com with your domain address).
each domain part preceded with \x and number of characters in hex, \x5F is _ symbol.
whenever computer tries to find active directory servers it requests for multiple DNS records all ending with _msdcs.yourdomain.com.
/ip firewall layer7-protocol
add comment="" name=activedirectory regexp=\
"\\x06\\x5Fmsdcs\\x06itsoft\\x02by"
2. added mangle to mark dns request packets matching our layer7 rule and our dns server as destination
/ip firewall mangle
add action=mark-packet chain=prerouting comment="" disabled=no dst-address=\
192.168.0.200 dst-port=53 layer7-protocol=activedirectory \
new-packet-mark=activedirectory passthrough=yes protocol=udp
3. added dst-nat rule to route active directory specific requests to actual domain server
/ip firewall nat
add action=dst-nat chain=dstnat comment=\
"forward active directory DNS requests" disabled=no dst-port=53 \
packet-mark=activedirectory protocol=udp to-addresses=10.10.0.201 \
to-ports=53
that's all. it works, at least in my particular configuration.
may be there are easier solutions, but I wasn't able to find any.
However since router is using provider's DNS, it is not possible to work with shared folders or perform any other domain tasks (while office IPs are readily accessible). Anything using active directory will fail, since any computer in home won't be able to resolve domain controllers.
How to fix this:
1. added layer7 matcher for \x06\x5Fmsdcs\x08mydomain\x03com
(you need to replace mydomain.com with your domain address).
each domain part preceded with \x and number of characters in hex, \x5F is _ symbol.
whenever computer tries to find active directory servers it requests for multiple DNS records all ending with _msdcs.yourdomain.com.
/ip firewall layer7-protocol
add comment="" name=activedirectory regexp=\
"\\x06\\x5Fmsdcs\\x06itsoft\\x02by"
2. added mangle to mark dns request packets matching our layer7 rule and our dns server as destination
/ip firewall mangle
add action=mark-packet chain=prerouting comment="" disabled=no dst-address=\
192.168.0.200 dst-port=53 layer7-protocol=activedirectory \
new-packet-mark=activedirectory passthrough=yes protocol=udp
3. added dst-nat rule to route active directory specific requests to actual domain server
/ip firewall nat
add action=dst-nat chain=dstnat comment=\
"forward active directory DNS requests" disabled=no dst-port=53 \
packet-mark=activedirectory protocol=udp to-addresses=10.10.0.201 \
to-ports=53
that's all. it works, at least in my particular configuration.
may be there are easier solutions, but I wasn't able to find any.
Monday, January 4, 2010
GeckoFX Multi 1.9.1.0 v.1
Download GeckoFX Multi 1.9.1.0 v.1
What is it?
GeckoFx Multi is modified GeckoFx library which:
Firefox 3.0 (or any other Gecko 1.9.0.x installation)
Firefox 3.5 (or any other Gecko 1.9.1.x installation)
Firefox 3.6b5 (or any other Gecko 1.9.2b5 installation)
Getting Started
GeckoFx is a very nice library developed by Skybound Software, which has one little drawback: it can be used only with specific version of XULRunner it was compiled for. It's not a big deal if
you are able to redistribute the always up-to-date XulRunner with your software, but it becomes a problem if your installation has to be as small as possible and you want to use Gecko installed at user's system (for example Firefox browser, which will probably be up-to-date itself).
Example of such program is HLR Ban Poster (http://garena.brains.by), with setup less than 1 mb in size, which autodetects and uses any Gecko available at user's system, and can rollback to standard Microsoft WebBrowser control in the worst case.
GeckoFx Multi uses proxies and custom marshalers to retain compatibility with xpcom NS interfaces changed in different Gecko versions.
Reliability and Compatibility
GeckoFx Multi modification was developed especially for use in one particular project (HLR Ban Poster), and wasn't throughly examinated in other conditions. All code inside original GeckoFx for supporting different Gecko versions was retained and converted, but wasn't throughly tested, so 100% compatibility can't be guaranteed.
In some situations GeckoFx Multi may work worse than original library, so if you need a stable Gecko-based control working with single dedicated version of Gecko engine I recommend using the latest library from SkyBound website (http://www.geckofx.org) instead.
How to use
The same way like you used usual GeckoFx. The same control, the same initialization, GeckoFxMulti should work instead of original GeckoFx library without any code modifications.
If you want to initialize GeckoFx with the latest supported version of Gecko present in the system (searches registry for applications distributed with Gecko (like Firefox), release versions are preferred over alpha/beta) use the following initializer:
Skybound.Gecko.Xpcom.Initialize(true);
The other possibility is to get all geckos detected at the system and give user the ability to select the desired one:
// just use auto detection
var gad = Skybound.Gecko.GeckoAppDiscovery();
// use auto detection and provide several custom gecko paths to check.
// you can also add custom gecko path to check using AddGeckoPath method
var gad = Skybound.Gecko.GeckoAppDiscovery("c:\\xul2.0", "c:\\firefoxportable3.6b5");
gad.AddGeckoPath("d:\\firefox");
After Gecko's discovery you can retrieve the list of all or valid-only geckos using the gad.Geckos or gad.ValidGeckos properties. Also you can initialize a single GeckoAppInfo class this way:
var gai = new Skybound.Gecko.GeckoAppInfo("d:\\firefox");
When your GeckoAppInfo structure is prepared (selected from ValidGeckos list or filled in manually), you can pass it to the Initialize method:
Skybound.Gecko.Xpcom.Initialize(gai);
Please note: you can't initialize several Gecko's at once or one after another, the only possible solution to let user pick second Gecko and initialize it is to restart your process (if your software is using a separate AppDomain for Gecko browser, it should be possible to reload just this AppDomain).
Changelog
1.9.1.0 v.1 based on GeckoFx 1.9.1.0 (4 Jan 2010)
What is it?
GeckoFx Multi is modified GeckoFx library which:
- Has built-in discovery of Gecko's based applications (like Firefox)
- Can be used with any Gecko version from: 1.8.1, 1.9.0, 1.9.1, 1.9.2b5, meaning it is compatible with the installations of:
Firefox 3.0 (or any other Gecko 1.9.0.x installation)
Firefox 3.5 (or any other Gecko 1.9.1.x installation)
Firefox 3.6b5 (or any other Gecko 1.9.2b5 installation)
- Single library (single compilation) for any Gecko version.
Getting Started
GeckoFx is a very nice library developed by Skybound Software, which has one little drawback: it can be used only with specific version of XULRunner it was compiled for. It's not a big deal if
you are able to redistribute the always up-to-date XulRunner with your software, but it becomes a problem if your installation has to be as small as possible and you want to use Gecko installed at user's system (for example Firefox browser, which will probably be up-to-date itself).
Example of such program is HLR Ban Poster (http://garena.brains.by), with setup less than 1 mb in size, which autodetects and uses any Gecko available at user's system, and can rollback to standard Microsoft WebBrowser control in the worst case.
GeckoFx Multi uses proxies and custom marshalers to retain compatibility with xpcom NS interfaces changed in different Gecko versions.
Reliability and Compatibility
GeckoFx Multi modification was developed especially for use in one particular project (HLR Ban Poster), and wasn't throughly examinated in other conditions. All code inside original GeckoFx for supporting different Gecko versions was retained and converted, but wasn't throughly tested, so 100% compatibility can't be guaranteed.
In some situations GeckoFx Multi may work worse than original library, so if you need a stable Gecko-based control working with single dedicated version of Gecko engine I recommend using the latest library from SkyBound website (http://www.geckofx.org) instead.
How to use
The same way like you used usual GeckoFx. The same control, the same initialization, GeckoFxMulti should work instead of original GeckoFx library without any code modifications.
If you want to initialize GeckoFx with the latest supported version of Gecko present in the system (searches registry for applications distributed with Gecko (like Firefox), release versions are preferred over alpha/beta) use the following initializer:
Skybound.Gecko.Xpcom.Initialize(true);
The other possibility is to get all geckos detected at the system and give user the ability to select the desired one:
// just use auto detection
var gad = Skybound.Gecko.GeckoAppDiscovery();
// use auto detection and provide several custom gecko paths to check.
// you can also add custom gecko path to check using AddGeckoPath method
var gad = Skybound.Gecko.GeckoAppDiscovery("c:\\xul2.0", "c:\\firefoxportable3.6b5");
gad.AddGeckoPath("d:\\firefox");
After Gecko's discovery you can retrieve the list of all or valid-only geckos using the gad.Geckos or gad.ValidGeckos properties. Also you can initialize a single GeckoAppInfo class this way:
var gai = new Skybound.Gecko.GeckoAppInfo("d:\\firefox");
When your GeckoAppInfo structure is prepared (selected from ValidGeckos list or filled in manually), you can pass it to the Initialize method:
Skybound.Gecko.Xpcom.Initialize(gai);
Please note: you can't initialize several Gecko's at once or one after another, the only possible solution to let user pick second Gecko and initialize it is to restart your process (if your software is using a separate AppDomain for Gecko browser, it should be possible to reload just this AppDomain).
Changelog
1.9.1.0 v.1 based on GeckoFx 1.9.1.0 (4 Jan 2010)
- Merged SkyBound modifications for GeckoFx 1.9.1.0.
- nsIDOMHTMLDocument.Get/SetTitle: changed back to nsAString, nsAUTF8String (introduced at GeckoFx 1.9.1) seems inappropriate here.
- Support for PreAlpha/Alpha/Beta Gecko sub-versions.
- Prepared for public release (additional constructor, etc).
- Preliminary support for Gecko 1.9.2 (tested with Firefox 3.6b5).
Subscribe to:
Posts (Atom)