1 W i n 3 2 W i n 6 4
1 Wi n32 Wi n64 25 Microsoft Windows (operating system, OS) Win32 API(application programming interface, ). 64 Win64 API, Win32 Win64., Win32 Win64 Windows Windows API. Win32 Win64. Windows, API,. OS API, Windows API. Windows. Windows,,,. C Windows. Windows,, PC, OS. OS OS.. OS (flat),,.. OS,,. OS.. (naming ),,,. OS.. OS,. (preempted),. 3) : (preempted).
26 Wi ndows Sys t em Pr ogr ammi ng 3. OS,.. OS,. Microsoft Windows Win32/Win64 API OS. Windows., API. Windows Windows API Windows.,., Windows Windows API..,. Windows API, API. Windows : (scalability). ( )..,,, -.,... API. API. API. Windows 1993 Windows. Microsoft. Home, Professional Windows XP. PC,, Windows XP..
1 Wi n32 Wi n64 27 Windows Server 2003, Small Business Server, Storage Server 2003. Windows 2003( Server ) (symmetric multi processing ). Win64 64 Windows 2003. Professional Server Windows 2000. Windows 2000, Windows XP Windows. Windows Embedded, Windows CE, Tablet PC, Windows Mobile Windows, Windows. Wi ndows Microsoft Windows,.. 1993 Windows NT 3.5, 3.5.1, 4.0 NT. Windows NT Version 4.0 Service Pack 3(SP 3). Windows 9x, NT. Windows 2000 NT Version 5.0, Windows 2000, 2003, XP Windows NT NT5. NT Version 4.0 ( ).. Windows 95, Windows 98, Windows Me( Windows 9x ), NT. Windows XP, Windows XP NT., Windows 9x., 16 OS Windows 3.1. Windows 3.1 Windows 95. Windows 3.1 (GUI) Windows GUI. Windows 3.1 API,, OS.
28 Wi ndows Sys t em Pr ogr ammi ng 3 1980 DOS IBM PC OS. DOS, DOS.,. DOS (batch file). Wi ndows NT 5. x Windows 2000 XP, 2003 NT Version 5.x NT5. Windows NT 5, ( 5.x x ). Windows XP NT 5.1., NT5. Windows NT5,. NT Windows 9x, Windows. Microsoft API NT, Windows(9x ), CE. Windows API. Wi ndows Windows( Win32, Win64 API, NT5 ).,. NT OS. Windows. Microsoft (Resource Kit) POSIX, POSIX.
1 Wi n32 Wi n64 29 Windows, (Hardware Abstraction Layer, HAL). HAL. Windows Intel x86. x86 Pentium Xeon, 486. Advanced Micro Devices(AMD). Windows., x86 64 Intel Itanium Windows 2003. Windows : Windows CE x86. Windows NT Digital Equipment Corporation ( Compaq HP ) Alpha. AMD Athlon 64 Opteron 64 (AMD64) x86 64. Itanium. Intel 32/64 64 x86. Windows OS Windows. OS, UNIX 1) Linux. Windows, Windows. Windows,,. 2) Windows UNIX Linux, Macintosh. 1) UNIX Linux POSIX API. 2) Windows Linux.. Linux Windows,.
30 Wi ndows Sys t em Pr ogr ammi ng 3 Windows, Windows. Windows. Windows GUI, Windows. Windows SMP. Windows. Windows. 3) Windows National Security Agency (NSA) C2 ( Windows 9x C ). UNIX Linux, Windows OS. Windows OS UNIX (, UNIX ). C2 NT. Windows OS,., Windows., Windows. Windows,, Windows API. UNIX Windows?, Windows?, Windows API?.,,. 4) 3) RAM 16MB 486 4 RAM 8GB 2GHz Xeon, Windows. : open system. Linux POSIX.
1 Wi n32 Wi n64 31 Windows API Linux UNIX POSIX API. Windows X/Open,. Windows. Microsoft, Windows. Windows. :.., Windows. OS....., Windows. Windows., Windows C, C++. Windows (Sockets) TCP/IP, Windows. (RPC). 4) SQL(Structured Query Language) (DBMS)., Windows. Windows TCP/IP, XWindows Windows., Windows, API. 4) Windows RPC Windows..
32 Wi ndows Sys t em Pr ogr ammi ng 3,.. Windows. UNIX, Linux, Macintosh, Windows Windows Wine. POSIX. Microsoft Windows Resource Kit Windows. Microsoft Visual C++., API Windows, POSIX, Macintosh. Windows Windows. Windows API UNIX Linux POSIX API API. Windows,. Windows,. (kernel object),,. UNIX (file descriptor) ID. 5) Windows API. (back door ). Windows,.,,,,,,.. Windows., Windows., ( Copy Fi l e. 5) Windows GUI HWND, HDC.
1 Wi n32 Wi n64 33 ).,,.. Windows. Windows.. Windows. Windows. Wa i t For Si ngl eobj e ct Wa i t For Si ngl eobj e ct Ex Wa i t For Mul t i pl eob j ec t s Wa i t NamedPi pe, (data type). API,. : BOOL (, 32 ) HANDLE DWORD ( 32 ) LPTSTR (8 16 ) LPSECURI TY_ATTRI BUTES. *, LPTSTR(TCHAR * ) LPCTSTR(cons t TCHAR * ) c ons t. : TCHAR char 2 wchar _t.,. l ps zfi l ename 0 (zero- terminated string, null ) (long pointer). dwacce s s (32 ). dw (double word).,. :,,,. Microsoft Visual C++. Pr ogr am Fi l es \ Mi cr osof t Vi sual St udi o.net\ Vc7\ Pl at f or msdk\ I ncl ude (VC++ 6.0 Pr ogr am Fi l es \ Mi cr osof t Vi sual St udi o\ VC98\ I ncl ude).
34 Wi ndows Sys t em Pr ogr ammi ng 3 WI NDOWS. H ( ) WI NNT.H WI NBASE. H, Win32 API, Windows 3.1 Win16 API... LPSTR LPDWORD LP long pointer, 32 64. ( ). long. LPVOI D PVOI D. 6) WIN32_ FIND_DATA WIN32, Win64. 16 Windows, 16. OpenFi l e, 16. Cr e at e Fi l e. Win64 Win64 AMD AMD64(Opteron Athlon 64) Intel Itanium ( Merced, McKinley, Madison, IA-64 ) Windows XP 2003. Win64. Win32 Win64 (Win64 64 ). Win64., Win64. 64, ( ). 6) PVOI D L, Microsoft L.
1 Wi n32 Wi n64 35, (LONG, DWORD ). DWORD32 DWORD64, POI NTER_ 32 POI NTER_ 64., Win32 Win64., Windows Win32 API. 16 Win64. UNIX Linux Windows., Windows HANDLE. HANDLE. UNIX 0, 1, 2, Windows. ID Windows. Windows HANDLE.,,,,. UNIX Windows. Windows HP( DEC Compaq). VMS OpenVMS. VMS David Cutler NT Windows.., Windows (job object),., UNIX LF Windows CR- LF. C : Windows, (2 3 ) C ANSI C. C ( ANSI ) <s t r i ng. h>, <st dl i b.h>, <si gnal. h>, I/O, I/O Windows
36 Wi ndows Sys t em Pr ogr ammi ng 3., <st di o.h> f open f r ead. C, Windows? C++ I/O.NET I/O., Windows, Windows C C++ I/O., Windows, C Windows. 3. C Windows, ( ), I/O, ( 4GB ),. C. C Windows.. 5, C..,, C.. Windows Microsoft Visual Studio.NET Microsoft Visual C++ Version 6.0 C. Microsoft.,. A. : Windows, Microsoft Visual Studio.NET.
1 Wi n32 Wi n64 37 RAM.,,. 7) CD- ROM ( ). Microsoft Visual C++.. Microsoft. :. 1. C 2. Windows 3. Windows CopyFi l e. C Windows..,.. Windows.,.. 7) 1997 16MB, 256MB.. 1000, 2500 PC RAM 10 (RAM PC ), 100, 50.
38 Wi ndows Sys t em Pr ogr ammi ng 3,., I/O,., Windows., UNIX cp..,. Windows. : UNIX. C 1-1, C FI LE I/O. FILE 1-2 Windows HANDLE,. 1-1 cpc: C / * 1. cp. C. */ / * cpc f i l e 1 f i l e2 : f i l e 1 f i l e2. */ #i ncl ude <s t di o. h> #i ncl ude <er r no. h> #defi ne BUF_ SIZE 256 i n t mai n (i nt ar gc, cha r *ar gv [] ) { FI LE *i n_ f i l e, *out _ f i l e ; char r ec [BUF_ SI ZE] ; s i ze_ t byt e s_ i n, byt e s_ ou t ; i f (ar gc!= 3 ) { pr i nt f ("Us age : cpc f i l e 1 f i l e2\ n " ) ; r e t ur n 1; i n_ f i l e = f op en (a r gv [1], "r b " ) ; i f (i n_ f i l e == NULL) {
1 Wi n32 Wi n64 39 per r or (ar gv [1] ) ; r et ur n 2 ; ou t _ f i l e = f op en (ar gv [2], "wb " ) ; i f (ou t _ f i l e == NULL) { per r or (ar gv [2 ] ) ; r et ur n 3 ; / *. */ wh i l e ( (b yt e s_ i n = f r ead (r ec, 1, BUF_ SI ZE, i n_ f i l e ) ) > 0 ) { byt e s_ out = f wr i t e (r e c, 1, byt e s_ i n, out _ f i l e ) ; i f (byt e s_ out!= byt e s_ i n ) { pe r r or ("Fat al wr i t e er r or. " ) ; r e t ur n 4; f c l os e (i n_ f i l e ) ; f c l os e (out _ f i l e ) ; r e t ur n 0;., Windows. 1. FI LE (UNIX ). NULL.. 2. f open. (end-of-line, EOL). Windows, I/O (C ).. 3. per r or. pe r r or er r no. FI LE pe r r or f e r r or.
40 Wi ndows Sys t em Pr ogr ammi ng 3 4. f r e ad fwr i t e.., 0. 5. f c l ose FI LE (UNIX ). 6. I/O., I/O 7. C I/O pr i nt f. Windows. C UNIX Windows, ANSI C., C C I/O. I/O, 7 Windows. UNIX, C (f s ee k f s et pos f get pos ). C I/O. : Visual C++., C. : I/O I/O C. Windows. Wi ndows 1-2 Windows API,,,. 1-2 cpw: Windows, / * 1. cp. Wi ndows. */ / * : cpw 1 2 1 2. */
1 Wi n32 Wi n64 41 #i n cl ude <wi ndows.h > #i n cl ude <s t di o. h> #de f i n e BUF_ SI ZE 256 i nt mai n (i n t ar gc, LPTSTR a r gv [] ) { HANDLE h I n, hout ; DWORD n I n, nou t ; CHAR Buf f er [BUF_ SI ZE] ; i f (ar gc!= 3 ) { p r i n t f ("Us age : cpw f i l e 1 f i l e2\ n " ) ; r et u r n 1 ; h I n = Cr eat efi l e (ar gv [1], GENERI C_ READ, 0, NULL, OPEN_ EXI STI NG, 0, NULL) ; i f (h I n == I NVALI D_HANDLE_VALUE) { p r i n t f ("Cannot open i nput f i l e. Er r or : %x\ n ", Get La s t Er r or () ) ; r et u r n 2 ; hout = Cr ea t efi l e (ar gv [2 ], GENERI C_WRI TE, 0, NULL, CREATE_ALWAYS, FI LE_ATTRI BUTE_NORMAL, NULL) ; i f (hout == I NVALI D_HANDLE_VALUE) { p r i n t f ("Cannot open ou t pu t f i l e. Er r or : %x \ n ", Get La s t Er r or () ) ; r et u r n 3 ; wh i l e (Re adfi l e (h I n, Bu f f e r, BUF_ SI ZE, &n I n, NULL) &&n I n > 0 ) { Wr i t efi l e (hou t, Bu f f e r, n I n, &nou t, NULL) ; i f (n I n!= nou t ) { pr i nt f ("Fat a l wr i t e e r r or : %x \ n ", Ge t La s t Er r or () ) ; r et ur n 4; Cl os ehandl e (h I n ) ; Cl os ehandl e (hout ) ; r e t ur n 0;, Windows. 2.
42 Wi ndows Sys t em Pr ogr ammi ng 3 1. <wi ndows. h>, Windows. 8) 2. Windows HANDLE. Cl os ehandl e. 3.. OS,. ( :.) 4. Windows.,. I NVALI D_HANDLE_VALUE GENERI C_READ. 5. Re adfi l e Wr i t e Fi l e... 9) 0. 0. 6. DWORD Get Las t Er r or. Windows 2-2. 7. Windows NT. 15. 8. Cr ea t e Fi l e,. Wi ndows Windows. ( C ). CopyFi l e, 8) A. 9) ANSI C and (&&) or ( ).
1 Wi n32 Wi n64 43., ( 256 ). CopyFi l e. 1-3 cpcf: Windows / * 1. cp., CopyFi l e Wi ndows. */ / * cpcf f i l e 1 f i l e2 : f i l e 1 f i l e2. */ #i n cl ude <wi ndows.h > #i n cl ude <s t di o. h> i nt mai n (i n t ar gc, LPTSTR a r gv [] ) { i f (ar gc!= 3 ) { p r i n t f ("Us age : cpcf f i l e 1 f i l e 2\ n " ) ; r et u r n 1 ; i f (!CopyFi l e (ar gv [1], a r gv [2], FALSE) ) { p r i n t f ("CopyFi l e Er r or : %x\ n ", Ge t La s t Er r or () ) ; r et u r n 2 ; r e t ur n 0; C Windows. C. Windows Windows, Windows. Windows. Windows NT5(XP, 2000, 2003)., NT Windows 9x(95, 98, Me).
44 Wi ndows Sys t em Pr ogr ammi ng 3 2 3 I/O. I/O, ASCII,,,,... Win 3 2 Win32, Marshall Brain Ron Reeves Win32 System Services Jeffrey Richter Programming Applications f or Microsof t Windows( Advanced Windows ). Windows 95 Windows NT. Microsoft Visual C++, Microsoft http://www.microsoft.com. Windows. MSDN(Microsoft Developer s Network).,,,. Win 6 4 Win64, Microsoft. 16. Win d o ws NT Wind o ws NT Windows Windows David Solomon Mark Russinovich Inside Windows 2000.,,,,, I/O, API Windows 9x, CE..
1 Wi n32 Wi n64 45, NT Helen Custer Solomon. UNIX ( ) W. Richard Stevens Advanced Programming in the UNIX Environment Windows UNIX. Stevens UNIX,. UNIX, UNIX( Linux). C I/O UNIX I/O, Windows. OS UNIX Eric S. Raymond The Art of UNIX Programming., Windows. Win d ows GUI Windows. Brent Rector Joseph M. Newcomer Win32 Programming Charles Petzold Programming Windows, Fif th Edition. OS. Abraham Silberschatz Operating System Concepts. ANS I C P. J. Plauger The Standard C Library., Brian W. Kernighan Dennis M. Ritchie The C Programming Language. C. C.
46 Wi ndows Sys t em Pr ogr ammi ng 3 Win d o ws CE Windows CE Jason P. Nottingham, Steven Makofsky, Andrew Tucker SAMS Teach Yourself Windows CE Programming in 24 Hours. UNIX Win d o ws Unix X Windows API Wine http://www.winehq.com. 1-1.,,. Microsoft Visual C++, UNIX ( Microsoft Visual C++ ). :. A Microsoft Visual Studio.NET Visual C++ 6.0. 1-2. Microsoft Visual Studio.NET Visual C++... A, Microsoft. 1-3. Windows - (CR- LF). 1-1? UNIX? 1-4...,. :. 6, C.