summaryrefslogtreecommitdiff
path: root/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h
blob: d2bb7a66718f2bb1a122088683458d3b5b27ec16 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#if !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_)
#define AFX_BUFFTOLOWERCASE__H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000



__inline DWORD BuffToLowerCase(LPCVOID lpcOutBuff,LPCVOID lpcBuff,SIZE_T dwLen)
{
	DWORD dwRetErrorCode=NO_ERROR;

	__asm
	{
		mov		ecx,dwLen
		test	ecx,ecx
		jz		short end_func

		push	ebx					// ñîõðàíÿåì ðåãèñòð
		push	edi					// ñîõðàíÿåì ðåãèñòð
		push	esi					// ñîõðàíÿåì ðåãèñòð
		mov		esi,lpcBuff
		mov		edi,lpcOutBuff
		mov		bl,'A'
		mov		bh,'Z'
		mov		ah,32
		cld

	lowcaseloop:
		lodsb
		cmp		al,bl
		jl		short savebyte
		cmp		al,bh
		jg		short savebyte
		or		al,ah

	savebyte:
		stosb

		dec		ecx
		jnz		short lowcaseloop

		pop		esi					// âîññòàíàâëèâàåì ñîäåðæèìîå ðåãèñòðà
		pop		edi					// âîññòàíàâëèâàåì ñîäåðæèìîå ðåãèñòðà
		pop		ebx					// âîññòàíàâëèâàåì ñîäåðæèìîå ðåãèñòðà
	end_func:
	}

return(dwRetErrorCode);
}




#endif // !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_)