Leona+ Dream for future

14Feb/100

SciTE64 v1.0.1 Beta Release Notes

Click here to download the latest SciTE64.

  • Integrated with SciTE 2.02
  • Add an executable to replace notepad.exe
  • Add some keywords to powershell.properties
Filed under: Software No Comments
3Feb/100

Execution Policy in Powershell

Powershell is a powerful tool that may be used to replace traditional batch command line. But by default, Powershell doesn't allow executing script file, (maybe for security reasons). Executing Powershell script will cause the following error message:

File <file_url> cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:11

+ .\<file_name> <<<<
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

This is because the default Execution Policy is Restricted, which means Powershell permits individual commands, but will not run scripts, including formatting and configuration files (.ps1xml), module script files (.psm1), and Windows PowerShell profiles (.ps1).

The solution is to loosen the policy, for example, set it to RemoteSigned or Unrestricted. Just run the following command in Powershell:

1
Set-ExecutionPolicy RemoteSigned

Then it alerts:

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution policy?

Press Y and it's done.

Filed under: Software No Comments
5Jan/101

God Mode in Windows 7

Although its name suggests perhaps even grander capabilities, Windows enthusiasts are excited over the discovery of a hidden "GodMode" feature that lets users access all of the operating system's control panels from within a single folder.

By creating a new folder in Windows 7 and renaming it with a certain text string at the end, users are able to have a single place to do everything from changing the look of the mouse pointer to making a new hard-drive partition.

To enter "GodMode," one need only create a new folder and then rename the folder to the following:

Leonax.Net.{ED7BA470-8E54-465E-825C-99712043E01C}

Once that is done, the folder's icon will change to resemble a control panel and will contain dozens of control options. I'm not sure it's my idea of playing God, but it is a handy way to get to all kinds of controls.

Filed under: Software 1 Comment
16Sep/094

64-bit SciTE

SciTE is a text editor based on Scintilla. It is small and fast but doesn't have 64 bit version. The performance is not improved much for a text editor to be 64 bit, but I prefer to use 64 bit application on 64 bit OS :P.

I compiled source code downloaded from official website and rename SciTE.exe and SciLexer.dll to SciTE64.exe and SciLexer64.dll, so that both version can share property files.

Here is the package for both x86 and x64 platforms: http://leonax.net/Leona2/wscite201.zip

Filed under: Software 4 Comments
9Jul/092

Number Sequence Puzzle Solver

闲着没事干的时候写的,用来求解给定数列的拟合函数,目前只支持多项式函数,比如给出数列“2 4 6 8”,则可以得出通项公式y = x * 2,并且下一项是10。

界面如下:

NSPSolver1

在文本框中输入数列(以空格分隔),比如“1 3 7 13 21 31”,点“Calculate”即可得出结果。

NSPSolver2

目前只支持整数数列和多项数的解……

有兴趣的同学请移步作品区下载。

Filed under: Software 2 Comments
6Jul/090

Install Microsoft Loopback Adapter in Windows 7

The Microsoft Loopback adapter is a testing tool for a virtual network environment where network access is not available. Also, you must use the Loopback adapter if there are conflicts with a network adapter or with a network adapter driver. You can bind network clients, protocols, and other network configuration items to the Loopback adapter, and you can install the network adapter driver or network adapter later while retaining the network configuration information.

Here is the installation steps:

  1. Right click [My Computer] and choose [Properties].
  2. Click [Device Manager] on the left side.
  3. Right click the root of the device tree and choose [Add legacy hardware].
  4. Click [Next].
  5. Select [Install the hardware that I manually select from a list] and click [Next].
  6. Select [Network Adapeter] and click [Next].
  7. Select [Microsoft] in the left list and then select [Microsoft Loopback Adapter] on the right. Click [Next].
  8. Click [Next] to start installation.
  9. Click [Finish] after installation.

Then you can find Microsoft Loopback Adapter under Network Adapter in Device Manager.

Filed under: Software No Comments
17Jun/090

Using MSXML in C Language


Several days ago I was asked how to use MSXML in C. I thought it should be easy since C also supports pointer and struct. There shouldn't be big change in the code, but I was wrong.


Let's see how to use MSXML in C++:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#import "msxml6.dll" raw_interfaces_only
 
#include <cstdio>
using namespace std;
 
#include "windows.h"
 
int main(){
	CoInitialize(NULL);
 
	MSXML2::IXMLDOMDocument2* doc = NULL;
	CoCreateInstance(__uuidof(MSXML2::DOMDocument60), NULL, CLSCTX_INPROC_SERVER, __uuidof(MSXML2::IXMLDOMDocument2), (LPVOID*)&doc);
 
	VARIANT_BOOL result;
	doc->loadXML(_bstr_t(L"<root/>"), &result);
 
	BSTR outxml = NULL;
	doc->get_xml(&outxml);
 
	wprintf(L"xml = %s\n", outxml);
 
	::SysFreeString(outxml);
	doc->Release();
 
	CoUninitialize();
 
	return 0;
}


To be simple, I includes "windows.h" directly and doesn't check the return value of every functions.


There are several items that are not supported in C:

  • Pre-processor #import.
  • Namespace
  • Keyword __uuidof
  • Actually doc->Release() this kind of call is aslo not supported. See the code below.


Here is the corresponding code in C:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#define COBJMACROS
#include "msxml6.h"
 
#include "windows.h"
#include "stdio.h"
 
int main(){
	IXMLDOMDocument2 *doc;
	VARIANT_BOOL loaded;
	BSTR inxml = SysAllocString(L"<root/>");
	BSTR outxml = NULL;
 
	CoInitialize(NULL);
	CoCreateInstance(&CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc);
	IXMLDOMDocument_loadXML(doc, inxml, &loaded);
	IXMLDOMDocument_get_xml(doc, &outxml);
 
	wprintf(L"XML = %s\n", outxml);
 
	SysFreeString(inxml);
	SysFreeString(outxml);
	IXMLDOMDocument_Release(doc);
 
	CoUninitialize();
 
	return 0;
}


The biggest change is COBJMACROS. We can use another form of function call by defining this marco. For example, doc->get_xml(&outxml) becomes IXMLDOMDocument_get_xml(doc, &outxml). Actually IXMLDOMDocument_get_xml(a,b) is a macro which will be expanded to a->vtbl->get_xml(a,b). As to what COBJMACROS means, I don't find any document so far...


Anyway, we are able to use MSXML in C and it is not so difficult.

Filed under: Software No Comments
4May/090

Aion Chinese doesn’t work with QQ 2009

Repro step: Open QQ 2009, then Aion. QQ crashes after window "Hacking Prevention System" pops up.

Call stack shows that crash happens inside apphelp.dll, but I have no time and no Symbols to debug...

The crash repro'es constantly on 64-bit Windows 7 RC.

The workaround is to close QQ and open it after Aion starts up completely.

Filed under: Software No Comments
1May/090

ActiveX plug-ins fail to install on IE7/8


Several ActiveX plug-ins fail to install on IE7/8, especially those key loggers. This is because IE7/8 improve the its protection.


Here is a workaround:

  • Open IE, with Administrator priviage in Vista and Windows 7.
  • Goto Tools -> Internet Options -> Advanced -> Enable memory protection to help mitigate online attacks, turn off this switch.
  • Then install the plug-in again.


The workaround above is tested on Windows 7 RC 64-bit and XP SP3.

Filed under: Software No Comments
28Feb/090

MSXML 4.0 SP2 Update Fails on Vista

MSXML4 SP2 QFE package(i.e., KB954430) fails to install on Vista (and later OS). Error message is "Error opening installation log file. Verify that the specified log file location exists and is writable."


The solution is to download the package to local hard disk, right click and choose "Run as administrator"

Filed under: Software No Comments