2011年4月19日 星期二

gcc & WINCE

很多 opensource project 都是用 gcc in Linux environment.
如果要porting 到WINCE 用Visual Studio 來 build
會遇到很難克服的麻煩 ( makefile.....)
build system 完全不同。

有以下兩種想法
1. 手工修改 製作 makefile 給nmake用 然後用 VS2008 build
2. use cross-platform build system 如 cmake 用 vs2008
3. 使用 gcc cross compiler for MIPS WINCE

第三點的話 cross compiler 有很多現成的
如 codesourcery
有提供 GNU/Linux 及 ELF 的版本
但是無法支援WINCE
因為 WINCE 是 (PE/COFF)


> Can I use gcc to compile Windows CE application? Our customer is very
> interested in gcc but he has to use Windows CE at the same time. We hope to
> find out a good solution for them. Thanks.

Our Sourcery G++ releases do not target Windows CE.  Our releases use
the ELF file format, while Windows CE uses a different object file
format (called PE/COFF).  There is some support for ARM Windows CE in
the GCC source code, but I'm not sure how well that works.
在gcc 的document 裏 有看到 support WINCE 的部份

Windows CE

Windows CE is supported as a target only on ARM (arm-wince-pe), Hitachi SuperH (sh-wince-pe), and MIPS (mips-wince-pe). note: binutils 2.14 之後取消了 mips-*-pe 的支援 所以能用的最新 binutils 為 2.13.2.1

2011年4月14日 星期四

Link error when using static class member

當使用 static class member 的時候
Link 時會出現錯誤 unresolved external symbol ...


http://stackoverflow.com/questions/195207/unresolved-external-symbol-on-static-class-members

原因是在 class header 中
class test
{
static unsigned char X;
static unsigned char Y;

};

這裏的 x 及 y 只是 declaration 而已,而非 definition

所以必需在 .cpp file 中 定義 static member

unsigned char test::X;
unsigned char test::Y;

否則會 link 不到。

2011年4月13日 星期三

在class 中 定義字串常數

我們都知道 在class 定義中
only static const int type 可以被定義

但是今天如果想定義一個字串 在class中被用到
要如何做呢

http://stackoverflow.com/questions/1563897/c-static-constant-string-class-member


You have to define your static member outside the class definition and provide the initailizer there.
// In a header file (if it is in a header file in your case)
class A {   private:      
  static const string RECTANGLE;
};
// In one of the implementation files
const string A::RECTANGLE = "rectangle";
The syntax you were originally trying to use (initializer inside class definition) is only allowed with integral and enum types.

2011年4月8日 星期五

Network problem, Cannot login with blank password

http://objectmix.com/inetserver/286550-user-blank-password-cannot-login.html


> I've set up a Windows 2003 box with IIS 6 and i need to have a user with a
blank password to access the FTP site. For some reason which i can't figure
out, IIS 6 won't allow the user with the blank password to connect, but when
a password is added is does. This is really weird as the user with th blank
password logged in OK on my original W2K with IIS 5 box. Can anyone tell me
how to get this working?

This is by design - read the document at
http://www.microsoft.com/windowsserv...nnovation.mspx
for a list of some of the security innovations that we have made in Windows
Server 2003 - one is that local users with blank passwords may not log on
remotely.

This can be changed by opening up the Local Security Policy, and under Local
Policies -> Security Options, you will find "Accounts: Limit local account
use of blank passwords to console logon only."

Needless to say, it's recommended that you keep the default setting, so that
non-anonymous access to your system is protected either by physical security
or a good password policy. If you have a need for public access to your
system, the "anonymous" FTP pseudo-user is a good method for doing this.




Windows Server 2003 以上 預設不允許 沒有密碼的 "遠端"登入,
這個可以在控制台裏的 Local Security Policy 中改變


Local Security Policy -> Local Policies -> Security Options ->
Accounts: Limit local account use of blank passwords to console logon only 
Disabled.

2011年4月1日 星期五

swscanf

http://linux.die.net/man/3/swscanf

MAP file

用map file 來除錯是很重要的
http://www.cchsu.com/arthur/prg_bg5/map_debug.htm
http://www.codeproject.com/KB/debug/mapfile.aspx


在map file 裏 RVA+Base 數值後面 如果是 f 的話 代表為函式

其中 ResetEvent SetEvent GetCurrentProcess  後面為 f  i
 i 的話 是 import? 還是 inline? 似乎都是 Kernel 函式( in coredll.lib )

i 是 inline
f 為 function