U E D R , A S I H C RSS

새싹교실/2012/세싹

1.

  • .
  • : 화 15:00~16:00
    12:00~13:00
  • .
  • : everything you want

2.

  • : pkccr1@gmail.com
  • : pkccr@nate.com

3. feedback

  • ZeroPage 4F(ThreeFs + Future Action Plan) feedback .
    • Facts, Feelings, Findings, Future Action Plan. , , , , 획.
    • : " 5 .() .() .() .( 획)"
      • ?
  • feedback .
    • ZeroWiki . 하 .
    • . 학 .

  • ZeroWiki MoniWiki Engine Google Chrome Mozila Firefox, Safari Internet Explorer .

4.1. 1회(2012 3 16)

4.1.1.

O
O
O

4.1.2.

  • wiki , .
  • gcc .
    1) https://www.virtualbox.org VirtualBux
    2) http://ftp.daum.net -> Ubuntu-releases -> 11.10 -> ubuntu-11.10-deskto-amd64.iso
    3) Virtualbox행 -> -> : Linux : Ubuntu -> 1024MB 폴트
    4) ubuntu 행 -> ISO파 트 ->
    ( : (101/104키 호환)!)
  • gcc hello world .
    1) gcc &
    2) (확 .c)
    3) 해
    4) terminal 행 -> .c 파 (ls cd .)
    5) gcc . (gcc 파.c -o -std=c99) 해 .
    6) 행합. (./파)
  • w3schools . (www.w3schools.com)
  • .
    • , , .

4.1.3.

  • wiki
    1) - . .
    2) - . feedback 항 .
  • gcc
    1) virtual box linux hello world .

4.1.4.

  • :D
    1) w3schools html파트
    2) linux
    3) gcc

4.1.5.

  • . , ( ). 학 . -
  • . . , . 히 해. . -
  • . Wiki , . . . -
  • 행하 . 7z . iso파 7z . -
    • ... iso파 .. ? -
    • 패하. 7z ... . cmd . msi 파 . --
    • amd64 cpu . i386 . -


4.2. 2회(2012 3 20)

4.2.1.

O
O
O

4.2.2.

  • .
    1) gcc . - gcc . :D
  • .
    1) 패킷 .
    2) .
    - app : . http, smtp, ftp .
    - transport : . , . TCP/UDP .
    - ip : 호트, (패킷) . .
    - link : . , 포함.
    - physical : . , .
    3) 하 .
    - , .
    - , .
    4) ?
    - (Internet socket, socket' network socket ) 한 통 .
    크 통 , 통해 환한. - wikipedia
    - :P byte stream .
    fopen() connect()
    read()/write() read()/write()
    close() close()
    5) http://forum.falinux.com/zbxe/?document_srl=441104 .

4.2.3.

  • c
    1) .
    2) .
    3) . 한 .
    4) gcc .
    5) .

4.2.4.

  • :D
    1) w3schools .

4.2.5.

  • =_=ㅋ ㅋㅋ -
  • . fail . ..... .. . . -
  • C ㅋㅋ -
  • ㅋㅋㅋㅋ -
  • . -
    • ... ... -
      • 2 .(?) -
  • . 해 할 . . 히 해 . 히 탐 . -
    • ... -
    • . VS . . . 행했 행했 Bind . 행할 포트 . ? -
      • bind , 해 포트 (bind하) bind하 . bind한 bind . bind 해 . -
      • ! . :) -
        • 한 해 . setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, &anyIntegerVariableThatContainsNonZero, sizeof(anyIntegerVariableThatContainsNonZero)); 함 포트 . -


4.3. 3회(2012 3 23)

4.3.1.

O
O
O

4.3.2.

  • .
    1) 포트 ?
    -
    포트 .
    - .
    2) 하 ?
    - . 험해 :D
    3) 편합. ?
    - thread
    concurrent .
    4) .
    - 향 통 off-line
    push형 . C2DM.
  • Thread .
    - thread .
    .

4.3.3.


  • - terminal 행해 .
  • .
  • , .
    - 클 while .

4.3.4.


4.3.5.

4.4. 4회(2012 3 27)

4.4.1.

O
O

4.4.2.

4.4.3.

  • socket thread .

4.4.4.


4.4.5.

  • . .. . . . . -

4.5. 5회(2012 3 30)

4.5.1.

O
O
O

4.5.4.


4.5.5.

4.6. 6회(2012 4 3)

4.6.1.

O
O
O

4.6.2.

  • NTFS .

  •   // 헤 : ntfs.h
    #pragma once
    #define _WIN32_WINNT 0x0500
    
    #include <windows.h>
    #include <winioctl.h>
    #include <stdio.h>
    
    typedef BOOLEAN TF;
    typedef	UCHAR U8;
    typedef USHORT U16;
    typedef ULONG U32;
    typedef ULONGLONG U64;
    
    typedef struct {
    	U32 Type;
    	U16 UsaOffset;
    	U16 UsaCount;
    	U64 Usn;
    } NTFS_RECORD_HEADER, *PNTFS_RECORD_HEADER;
    
    typedef struct {
    	NTFS_RECORD_HEADER Ntfs;
    	U16 SequenceNumber;
    	U16 LinkCount;
    	U16 AttributeOffset;
    	U16 Flags;		// inUse 0x0001 Directory 0x0002
    	U32 BytesInUse;
    	U32 BytesAllocated;
    	U64 BaseFileRecord;
    	U16 NextAttributeNumber;
    } FILE_RECORD_HEADR, *PFILE_RECORD_HEADER;
    
    // Standard Attribute
    
    typedef enum {
    	AttributeStandardInformation = 0x10,
    	AttributeAttributeList = 0x20,
    	AttributeFileName = 0x30,
    	AttributeObjectId = 0x40,
    	AttributeSecurityDesciptor = 0x50,
    	AttributeVolumeName = 0x60,
    	AttributeVolumeInformation = 0x70,
    	AttributeData = 0x80,
    	AttributeIndexRoot = 0x90,
    	AttributeIndexAllocation = 0xA0,
    	AttributeBitmap = 0xB0,
    	AttributeReparsePoint = 0xC0,
    	AttributeEAInformation = 0xD0,
    	AttributeEA = 0xE0,
    	AttributePropertySet = 0xF0,
    	AttributeLoggedUtilityStream = 0x100
    } ATTRIBUTE_TYPE, *PATTRIBUTE_TYPE;
    
    typedef struct {
    	ATTRIBUTE_TYPE AttributeType;
    	U32 Length;
    	TF Nonresident;
    	U8 NameLength;
    	U16 NameOffset;
    	U16 Flags;
    	U16 AttributeNumber;
    } ATTRIBUTE, *PATTRIBUTE;
    
    typedef struct {
    	ATTRIBUTE Attribute;
    	U32 ValueLength;
    	U16 ValueOffset;
    	U16 Flags;
    } RESIDENT_ATTRIBUTE,*PRESIDENT_ATTRIBUTE;
    
    
    
    #pragma pack(push, 1)
    typedef struct {
    	U8 Jump[3];
    	U8 Format[8];
    	U16 BytesPerSector;	// 
    	U8 SectorsPerCluster;	//
    	U16 BootSectors;
    	U8 Mbz1;
    	U16 Mbz2;
    	U16 Reserved1;
    	U8 MediaType;
    	U16 Mbz3;
    	U16 SectorsPerTrack;
    	U16 NumberOfHeads;
    	U32 PartitionOffset;
    	U32 Reserved2[2];
    	U64 TotalSectors;	//  .
    	U64 MftStartLcn;	//MFT  .
    	U64 Mft2StartLcn;	// MFT Mirror   
    	U32 ClustersPerFileRecord;	// 파 
    	U32 ClustersPerIndexBlock;	//	 
    	U64 VolumeSerialNumber;
    	U8 Code[0x1AE];
    	U16 BootSignature;
    } BOOT_BLOCK, *PBOOT_BLOCK;
    #pragma pack(pop)
    
    - main.cpp

#include "ntfs.h"

U32 BytesPerFileRecord;
BOOT_BLOCK boot_block;
HANDLE hVolume;
U32 cnt;
CHAR drive[] = "\\\\.\\C:";
PFILE_RECORD_HEADER MFT;


void ReadSector(U64 sector, U32 count, void* buffer);
void LoadMFT();

void main()
{

	hVolume = CreateFile(drive, GENERIC_READ,FILE_SHARE_READ | FILE_SHARE_WRITE, 0,OPEN_EXISTING, 0, 0);
	ReadFile(hVolume, &boot_block, sizeof(boot_block), &cnt, 0);
	
	printf("======My FILE SYSTEM INFO==========\n");
	printf("File System : %s \n",boot_block.Format);
	printf("Total Sectors : %u \n",boot_block.TotalSectors);
	printf("Sector per Bytes : %u \n",boot_block.BytesPerSector);
	printf("Cluster per Sectors : %u\n",boot_block.SectorsPerCluster);
	printf("Clusters Per FileRecord : %u\n",boot_block.ClustersPerFileRecord);
	printf("Clusters Per IndexBlock : %u\n",boot_block.ClustersPerIndexBlock);

}

void LoadMFT()
{
	BytesPerFileRecord = boot_block.ClustersPerFileRecord < 0x80? boot_block.ClustersPerFileRecord* boot_block.SectorsPerCluster* boot_block.BytesPerSector : 1 << (0x100 - boot_block.ClustersPerFileRecord);
	MFT = PFILE_RECORD_HEADER(new U8[BytesPerFileRecord]);
	ReadSector(boot_block.MftStartLcn * boot_block.SectorsPerCluster,	BytesPerFileRecord / boot_block.BytesPerSector, MFT);
	printf("buffer : %s\n", MFT+0x27);
}

void ReadSector(U64 sector, U32 count, void* buffer)
{
	ULARGE_INTEGER offset;
	OVERLAPPED overlap = {0};
	U32 n;
	
	offset.QuadPart = sector * boot_block.BytesPerSector;
	overlap.Offset = offset.LowPart; 
	overlap.OffsetHigh = offset.HighPart;
	ReadFile(hVolume, buffer, count * boot_block.BytesPerSector, &n, &overlap);
	
}

4.6.4.

  • . 힌트 - cpp 할, 함

4.6.5.

  • . -
  • . . -

4.7. 7회(2012 4 6)

4.7.1.

O
O
X

4.7.2.

  • NTFS

4.7.3.

  • MFT

4.7.5.

  • URP . :D -
    • F .ㅠㅜ -
  • NTFS . . .
    . . -

4.8. 8회(2012 4 10)

4.8.1.

O
O
O

4.8.4.

  • NTFS 해 틈틈히 .

4.8.5.


4.9. 9회(2012 4 13)

4.9.1.

O
O
O

4.9.2.

#include "ntfs.h"

U32 BytesPerFileRecord;
BOOT_BLOCK boot_block;
HANDLE hVolume;
U32 cnt;
CHAR drive[] = "\\\\.\\C:";
//WCHAR drive[] = TEXT("\\\\.\\C:");
PFILE_RECORD_HEADER MFT;


void ReadSector(U64 sector, U32 count, void* buffer);
void LoadMFT();

void main()
{

	hVolume = CreateFile(drive, GENERIC_READ,FILE_SHARE_READ | FILE_SHARE_WRITE, 0,OPEN_EXISTING, 0, 0);
	ReadFile(hVolume, &boot_block, sizeof(boot_block), &cnt, 0);
//	FILE *fp=fopen(drive,"rb");
//	fread((void*)&boot_block,sizeof(boot_block),1,fp);

	printf("======My FILE SYSTEM INFO==========\n");
	printf("File System : %s \n",boot_block.Format);
	printf("Total Sectors : %u \n",boot_block.TotalSectors);
	printf("Sector per Bytes : %u \n",boot_block.BytesPerSector);
	printf("Cluster per Sectors : %u\n",boot_block.SectorsPerCluster);
	printf("Clusters Per FileRecord : %u\n",boot_block.ClustersPerFileRecord);
	printf("Clusters Per IndexBlock : %u\n",boot_block.ClustersPerIndexBlock);
	printf("\n\n");
	LoadMFT();
}

void LoadMFT()
{
	int i;
	BytesPerFileRecord = boot_block.ClustersPerFileRecord < 0x80? boot_block.ClustersPerFileRecord* boot_block.SectorsPerCluster* boot_block.BytesPerSector : 1 << (0x100 - boot_block.ClustersPerFileRecord);
	MFT = PFILE_RECORD_HEADER(new U8[BytesPerFileRecord]);

	ReadSector(boot_block.MftStartLcn * boot_block.SectorsPerCluster,	BytesPerFileRecord / boot_block.BytesPerSector, MFT);

	printf("$MFT's Signaturer : %s\n", MFT);//+0x27);
	printf("Offset to fixup array : 0x%02x%02x\n", *((unsigned char*)MFT+5),*((unsigned char*)MFT+4));
	printf("Number of this MFT Entry : 0x%02x%02x%02x%02x\n"
		, *((unsigned char*)MFT+47),*((unsigned char*)MFT+46),*((unsigned char*)MFT+45),*((unsigned char*)MFT+44));

	
	printf("Offset to first attribute : 0x%02x%02x \n"
		, *((unsigned char*)MFT+21),*((unsigned char*)MFT+20));



	i=((int)(*((unsigned char*)MFT+21))<<8)+*((unsigned char*)MFT+20);//Offset 
	printf("First Attribute : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	i+=4;// 4
	printf("First Attribute Size : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	printf("\n");

	

	i=	i+
		((int)(*((unsigned char*)MFT+i+3))<<24)+
		((int)(*((unsigned char*)MFT+i+2))<<16)+
		((int)(*((unsigned char*)MFT+i+1))<<8)+
		*((unsigned char*)MFT+i)
		-4;// 한 4 .

	printf("Second Attribute : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	i+=4;// 4
	printf("Second Attribute Size : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	printf("\n");


	i=	i+
		((int)(*((unsigned char*)MFT+i+3))<<24)+
		((int)(*((unsigned char*)MFT+i+2))<<16)+
		((int)(*((unsigned char*)MFT+i+1))<<8)+
		*((unsigned char*)MFT+i)
		-4;// 한 4 .

	printf("Third Attribute : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	i+=4;// 4
	printf("Third Attribute Size : 0x%02x%02x%02x%02x\n",*((unsigned char*)MFT+i+3),*((unsigned char*)MFT+i+2),*((unsigned char*)MFT+i+1),*((unsigned char*)MFT+i));
	printf("\n");
	
/*
	ReadSector(boot_block.Mft2StartLcn * boot_block.SectorsPerCluster,	BytesPerFileRecord / boot_block.BytesPerSector, MFT);

	printf("$MFT Mirr's Signaturer : %s\n", MFT);//+0x27);
	printf("Offset to fixup array : 0x%02x%02x\n", *((unsigned char*)MFT+5),*((unsigned char*)MFT+4));
	printf("Number of this MFT Entry : 0x%02x%02x%02x%02x\n"
		, *((unsigned char*)MFT+47),*((unsigned char*)MFT+46),*((unsigned char*)MFT+45),*((unsigned char*)MFT+44));
	printf("\n");
//*/

	printf("MftStartLcn : %d\n",boot_block.MftStartLcn);
	printf("Mft2StartLcn : %d\n",boot_block.Mft2StartLcn);
}


void ReadSector(U64 sector, U32 count, void* buffer)
{
	ULARGE_INTEGER offset;
	OVERLAPPED overlap = {0};
	U32 n;
	
	offset.QuadPart = sector * boot_block.BytesPerSector;
	overlap.Offset = offset.LowPart; 
	overlap.OffsetHigh = offset.HighPart;
	ReadFile(hVolume, buffer, count * boot_block.BytesPerSector, &n, &overlap);
}

4.9.4.



4.9.5.

  • , 환하 .
    .
    htons, htonl
  • HxD . 4 8 . .
    http://mh-nexus.de/en/hxd/ -
  • Code jam ... -
  • . 4bit unsigned 3byte,7byte unsigned .ㅠㅜ -


4.10. 10회(2012 4 17)

4.10.1.

O
O
O

4.10.2.

#include "ntfs.h"

U32 BytesPerFileRecord;
BOOT_BLOCK boot_block;
HANDLE hVolume;
U32 cnt;
CHAR drive[] = "\\\\.\\C:";
//WCHAR drive[] = TEXT("\\\\.\\C:");
PFILE_RECORD_HEADER MFT;


void ReadSector(U64 sector, U32 count, void* buffer);
void LoadMFT();
unsigned int LoadAttribute(int i);

unsigned __int64 htonll(unsigned __int64);
unsigned int htonl(unsigned int);
//unsigned short htons(unsigned short);

void main()
{

	hVolume = CreateFile(drive, GENERIC_READ,FILE_SHARE_READ | FILE_SHARE_WRITE, 0,OPEN_EXISTING, 0, 0);
	ReadFile(hVolume, &boot_block, sizeof(boot_block), &cnt, 0);
//	FILE *fp=fopen(drive,"rb");
//	fread((void*)&boot_block,sizeof(boot_block),1,fp);

	printf("======My FILE SYSTEM INFO==========\n");
	printf("File System : %s \n",boot_block.Format);
	printf("Total Sectors : %u \n",boot_block.TotalSectors);
	printf("Sector per Bytes : %u \n",boot_block.BytesPerSector);
	printf("Cluster per Sectors : %u\n",boot_block.SectorsPerCluster);
	printf("Clusters Per FileRecord : %u\n",boot_block.ClustersPerFileRecord);
	printf("Clusters Per IndexBlock : %u\n",boot_block.ClustersPerIndexBlock);
	printf("\n\n");
	LoadMFT();
	system("pause");
}

void LoadMFT()
{
	int point;
	unsigned __int64 num;
	BytesPerFileRecord = boot_block.ClustersPerFileRecord < 0x80? boot_block.ClustersPerFileRecord* boot_block.SectorsPerCluster* boot_block.BytesPerSector : 1 << (0x100 - boot_block.ClustersPerFileRecord);
	MFT = PFILE_RECORD_HEADER(new U8[BytesPerFileRecord]);

	printf("MftStartLcn : %016x\n",boot_block.MftStartLcn);
	printf("Mft2StartLcn : %016x\n",boot_block.Mft2StartLcn);
	printf("\n");

	//0     MFT entry   .
	ReadSector((boot_block.MftStartLcn+0) * boot_block.SectorsPerCluster,	BytesPerFileRecord / boot_block.BytesPerSector, MFT);
	

	printf("MFT's Signaturer : %s\n", MFT);//+0x27);
	printf("Offset to fixup array : 0x%02x%02x\n", *((unsigned char*)MFT+5),*((unsigned char*)MFT+4));
	printf("Number of this MFT Entry : 0x%02x%02x%02x%02x\n"
		, *((unsigned char*)MFT+47),*((unsigned char*)MFT+46),*((unsigned char*)MFT+45),*((unsigned char*)MFT+44));

	printf("Offset to first attribute : 0x%02x%02x \n"
		, *((unsigned char*)MFT+21),*((unsigned char*)MFT+20));
	printf("\n");


	point=((int)(*((unsigned char*)MFT+21))<<8)+*((unsigned char*)MFT+20);//Offset 
	
	printf("Attribute List Start\n\n");
	while(htonl(*((unsigned int*)((unsigned char*)MFT+point)))!=0xFFFFFFFF)
		point+=LoadAttribute(point);
	printf("Attribute List End\n");

	printf("\n");

}

unsigned int LoadAttribute(int point)
{
	int i=0,j=0,k=0;
	int HeaderSize;

	/*
		*((unsigned char*)MFT+i+9) = Attribute Name Size
		Resident=24 / Non-resident=64
	*/

	if(*((unsigned char*)MFT+point+8))
		HeaderSize=64+*((unsigned char*)MFT+point+9);
	else
		HeaderSize=24+*((unsigned char*)MFT+point+9);


	switch(htonl(*((unsigned int*)((unsigned char*)MFT+point))))
	{
	case 0x10://$STANDARD_INFORMATION
		printf("Attribute type : Standard Information\n");
		break;

	case 0x20://$ATTRIBUTE_LIST
		printf("Attribute type : Attribute List\n");
		break;

	case 0x30://$FILE_NAME
		printf("Attribute type : File Name\n");
		printf("File Name Size : %d\n",*((unsigned char*)MFT+point+HeaderSize+64));	
		printf("File NameSpace : ");
		switch(*((unsigned char*)MFT+point+HeaderSize+65))
		{
		case 0:
			printf("POSIX\n");
			break;
		case 1:
			printf("Win32\n");
			break;
		case 2:
			printf("DOS\n");
			break;
		case 3:
			printf("Win32 & DOS\n");
			break;
		}
		printf("File Name : ");
		for(j=0;j<2**((unsigned char*)MFT+point+HeaderSize+64);j++)
			printf("%c",*((unsigned char*)MFT+point+HeaderSize+66+j));
		printf("\n");
		break;

	case 0x40://$
		printf("Attribute type : \n");
		break;

	case 0x50://$SECURITY_DESCRIPTOR
		printf("Attribute type : Security Descriptor\n");
		break;

	case 0x60://$
		printf("Attribute type : \n");
		break;

	case 0x70://$
		printf("Attribute type : \n");
		break;

	case 0x80://$DATA
		printf("Attribute type : Data\n");

		//__int64  little endian .    ...
		printf("Run List  Start VCN : %I64d\n",*((unsigned __int64*)((unsigned char*)MFT+point+16)));
		printf("Run List   End  VCN : %I64d\n",*((unsigned __int64*)((unsigned char*)MFT+point+24)));
		printf("Run List Start Offset : 0x%02x%02x\n",*((unsigned char*)MFT+point+33),*((unsigned char*)MFT+point+32));

//		printf("Cluster Size : %I64d\n",*((unsigned __int64*)((unsigned char*)MFT+point+40)));
//		printf("Attribute Size : %I64d\n",*((unsigned __int64*)((unsigned char*)MFT+point+48)));
//		printf("real Size : %I64d\n",*((unsigned __int64*)((unsigned char*)MFT+point+56)));

		i=(int)*((unsigned char*)MFT+point+33)+*((unsigned char*)MFT+point+32);

		for(j=0;j<(*((unsigned char*)MFT+point+i)&0x0F);j++)//*((unsigned __int64*)((unsigned char*)MFT+point+24));j++)
		{
			printf("Cluster %d lenth : 0x",j);
			for(k=0;k<(*((unsigned char*)MFT+point+i)&0x0F);k++)
				printf("%02x",*((unsigned char*)MFT+point+i+(*((unsigned char*)MFT+point+i)&0x0F)-k));
			printf("\n");

			printf("Cluster %d offset : 0x",j);
			for(;k<(*((unsigned char*)MFT+point+i)&0x0F)+((*((unsigned char*)MFT+point+i)&0xF0)>>4);k++)
				printf("%02x",*((unsigned char*)MFT+point+i
					+(*((unsigned char*)MFT+point+i)&0x0F)+((*((unsigned char*)MFT+point+i)&0xF0)>>4)
					-k+(*((unsigned char*)MFT+point+i)&0x0F)));
			printf("\n");
			i+=(*((unsigned char*)MFT+point+i)&0x0F)+((*((unsigned char*)MFT+point+i)&0xF0)>>4)+1;
		}
		break;
	case 0xB0:
		printf("Attribute type : Bitmap\n");
		break;
	}

	printf("\n");

	return htonl(*((unsigned int*)((unsigned char*)MFT+point+4)));
}

void ReadSector(U64 sector, U32 count, void* buffer)
{
	ULARGE_INTEGER offset;
	OVERLAPPED overlap = {0};
	U32 n;
	
	offset.QuadPart = sector * boot_block.BytesPerSector;
	overlap.Offset = offset.LowPart; 
	overlap.OffsetHigh = offset.HighPart;
	ReadFile(hVolume, buffer, count * boot_block.BytesPerSector, &n, &overlap);
}



unsigned __int64 htonll(unsigned __int64 LittleEndian)
{
	unsigned __int64 BigEndian;
	int i;
	LittleEndian>>=16;
	BigEndian=0;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+7))<<54;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+6))<<48;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+5))<<40;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+4))<<32;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+3))<<24;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+2))<<16;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+1))<<8;
	BigEndian+=(unsigned __int64)(*((unsigned char*)&LittleEndian+0));
	return BigEndian;
}


unsigned int htonl(unsigned int LittleEndian)
{
	unsigned int BigEndian;
	BigEndian=
		((unsigned int)(*((unsigned char*)&LittleEndian+3))<<24)+
		((unsigned int)(*((unsigned char*)&LittleEndian+2))<<16)+
		((unsigned int)(*((unsigned char*)&LittleEndian+1))<<8)+
		*((unsigned char*)&LittleEndian)
		;
	return BigEndian;
}



/*
unsigned short htons(unsigned short LittleEndian)
{
	unsigned short BigEndian;
	BigEndian=
		((unsigned short)(*((unsigned char*)&LittleEndian+1))<<8)+
		*((unsigned char*)&LittleEndian)
		;
	return BigEndian;
}
/*/



4.10.4.


4.10.5.


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:46
Processing time 0.1040 sec