|
Ryan Binns wrote: Actually, it does violate the standard
Actually, undefined behaviour is not a violation of the standard. It is what it says "undefined", that means it is up to the compiler [vender] to determine what its behaviour is.
Personaly, I think it should translate into:
data[i] = i;
++i; OR
data[i] = (temp = i + 1);
i = temp; but that is just my opinion.
INTP
Every thing is relative...
|
|
|
|
|
|
Trollslayer wrote: Did you change the warning level to 4? (Project->Settings->C/C++)
I just checked with both VS6 and VS 2003, both of them dont detect and warn for a[i] = i++. Do you have VS 2005 to check this out? GCC 3.4.3 does, if you want to check this out with GCC.
thanks!
|
|
|
|
|
|
Hello,
I'd like to release an application in several languages(english, french and spanish).
I know I can do it by traducing only my resource file. In fact, I've included all strings I use as resources.
But I don't want to duplicate my application directory for each language. I'd like to manage all languages only from one workspace under Visual C++ 6.
Can you please tell me how to do or point me to a document discussing it?
Thanks
Best regards,
Allad
----
Navigator - Your best alternative to Windows Explorer
|
|
|
|
|
I have written programs that allow multiple languages, but I have not written one that supported multiple languages for the interface.
Given that, there is a book from Microsoft press that explains the subject. I forget its name but it was included in the VC6 MSDN library and the 2nd edition came out last year.
There is also an article some where on CP on the subject.
Essentially it breaks down to providing a DLL for each language that contains the strings for the required languages. In order to change the language all you have to do is change the DLL. In other words, your string resources are stored in a DLL. You still have to make sure that you give enough room in the text fields (at least in dialogs) for longer text strings or shorter text strings.
The biggest problem is working with Asian text, because you have to give extra room for the height. Outside of Asian characters I have not [yet] ran across double byte characters.
I do need to warn you, in the middle-east we may have a totally different problem, but I am not going to discuss that now.
INTP
Every thing is relative...
|
|
|
|
|
Thank you for replying.
However, I do not want to write an application that supports multiple language for the interface.
I'd just like to build one different version of my app for each language. Maybe it's a bit easier?
Best regards,
Allad
----
Navigator - Your best alternative to Windows Explorer
|
|
|
|
|
Sorry, I have been on a break.
The simplist approach would be to write your code using the functions prefixed with "_t" (Microsoft specific) to support single-byte, multibyte, and UNICODE character sets, depending on how it is compiled. Then require that their machine requires an OS (NT, Win2000, WinXP+) that supports UNICODE and only compile your code for UNICODE. Then you should be able to create one application that supports all UNICODE supported languages with one program (not including the interface).
If you need to support Win3.1, Win95, Win98, or Millinium Edition then it is to complicated to explain.
Good luck!
INTP
Every thing is relative...
|
|
|
|
|
I need to delete application files producing when user use my App in the uninstalling process.How can i know all users' account in order to delete files in Document Setting(Win2k).
Thanks
|
|
|
|
|
NetUserEnum
The NetUserEnum function provides information about all user accounts on a server.
|
|
|
|
|
|
PUSER_INFO_3 users;
LPWSTR lp1;
DWORD d1,d2;
DWORD SizeName=sizeof(Name);
GetComputerName(Name,&SizeName);
lp1=A2W (Name);
NetApiBufferAllocate(1024,(LPVOID*)&users);
NetUserEnum(lp1,3,FILTER_NORMAL_ACCOUNT,(LPBYTE*)&users,MAX_PREFERRED_LENGTH, &d1,&d1,NULL );
and also use USES_CONVERSION; in the first code
I hope helpful for you
|
|
|
|
|
You need to reword this. I am amazed I understood what I did.
INTP
Every thing is relative...
|
|
|
|
|
i want to hook the dll funtion, my mothod is modification the exe Import Table.
have other method of hook dll and not need modification the Import Table and Export Table.
thanks.
|
|
|
|
|
HOW WHAT wrote: have other method of hook dll and not need modification the Import Table and Export Table.
you can change first bytes of function to far jmp that points on your code.
|
|
|
|
|
|
This example shows the hook of GetModuleHandleW in target process(process where you injected your dll). It works only in 32-bit windows.
If you injected your dll into multithreaded process you must synchronize execution of this code with other threads or program sometimes may crash.
<br />
#define BYTES_COUNT 0x05<br />
<br />
BYTE firstBytes[BYTES_COUNT];<br />
void *pfnGetModuleHandle;<br />
HANDLE __stdcall Handler(HANDLE hModule);<br />
<br />
BOOL HookGetModuleHandle()<br />
{<br />
HANDLE hKernel32;<br />
DWORD dwOldProtect;<br />
<br />
hKernel32 = LoadLibrary(_T("kernel32.dll"));<br />
pfnGetModuleHandle = GetProcAddress((HMODULE)hKernel32, "GetModuleHandleW");<br />
<br />
if (hKernel32 == NULL || pfnGetModuleHandle == NULL)<br />
{<br />
return FALSE;<br />
}<br />
<br />
memcpy(&firstBytes, pfnGetModuleHandle, BYTES_COUNT);<br />
<br />
if (!VirtualProtect(pfnGetModuleHandle, BYTES_COUNT, PAGE_READWRITE, &dwOldProtect))<br />
{<br />
return FALSE;<br />
}<br />
<br />
*((BYTE*)pfnGetModuleHandle) = 0xE9;<br />
*((DWORD*)(((BYTE*)pfnGetModuleHandle)+1)) = (DWORD)Handler - (DWORD)pfnGetModuleHandle - BYTES_COUNT;<br />
<br />
if (!VirtualProtect(pfnGetModuleHandle, BYTES_COUNT, dwOldProtect, NULL))<br />
{<br />
return FALSE;<br />
}<br />
<br />
return TRUE;<br />
}<br />
<br />
BOOL UnhookGetModuleHandle()<br />
{<br />
DWORD dwOldProtect;<br />
<br />
if (!VirtualProtect(pfnGetModuleHandle, BYTES_COUNT, PAGE_READWRITE, &dwOldProtect))<br />
{<br />
return FALSE;<br />
}<br />
<br />
memcpy(pfnGetModuleHandle, &firstBytes, BYTES_COUNT);<br />
<br />
if (!VirtualProtect(pfnGetModuleHandle, BYTES_COUNT, dwOldProtect, NULL))<br />
{<br />
return FALSE;<br />
}<br />
<br />
return TRUE;<br />
}<br />
<br />
HANDLE __stdcall Handler(HANDLE hModule)<br />
{<br />
HANDLE returned;<br />
printf("GetModuleHandleW call detected\n");<br />
UnhookGetModuleHandle();<br />
__asm {<br />
push hModule<br />
call pfnGetModuleHandle<br />
mov returned, eax<br />
}<br />
HookGetModuleHandle();<br />
}<br />
|
|
|
|
|
your method and modification the Import Table, which will be highness and safe?
|
|
|
|
|
My method is better to use, because it never fail, except when application detected and removed hook(very very rarely), but it creates additional problems with synchronization in mt applications and it doesn't work on windows other than 32 bit(without modification).
IAT modification is also good method, but this hook wouldn't work if application directly calls functions(call GetProcAddress to retrieve address of function...). Second method fails more offen than first.
Also you can create a dll that debugs process in which it injected by inserting int3 instructions into functions you want to hook. If number of functions to hook =< 4 you can use hardware breakpoints, setting hardware breakpoints do not require any code modifications.
|
|
|
|
|
1.Your method if had some call hooked function may be happen some exception, right?
2.How to do like you say
"Also you can create a dll that debugs process in which it injected by inserting int3 instructions into functions you want to hook. If number of functions to hook =< 4 you can use hardware breakpoints, setting hardware breakpoints do not require any code modifications. "
Some time ago, I download codeproject about use debug process to inject dll, but in win98 all application will happen crash.
|
|
|
|
|
HOW WHAT wrote: 1.Your method if had some call hooked function may be happen some exception, right?
Only when application threads are not synchronized and context of current thread(that now hooking function) is switched to other that calls hooked function.
HOW WHAT wrote: 2. How to do like you say
There is an error in code you just downloaded.
Armadillo protector uses the same technique and it works best on Windows 9x\Me
Give me the URL of this example or send it to my mail - sharebyte gmail com
|
|
|
|
|
Hello all!
Problem: I am using SQL frm within my C++ code.
Can anyone tell me HOW to change a name of a column of a table (for a MS Access 2000 database)?
Using "ALTER TABLE table_name RENAME COLUMN old_name TO new_name" seems not to work because of syntax failure !
Thanks
|
|
|
|
|
What's the exact query you're using?
Jeremy Falcon
|
|
|
|
|
The table is: Cars
The column I want to rename: Colour (of type CHARACTER VARYING(255))
ALTER TABLE Cars RENAME COLUMN Colour TO FormerColour CHARACTER VARYING(255)
Thanks
-- modified at 1:44 Sunday 12th March, 2006
|
|
|
|
|
You don't need the the type of the column to rename it. This should do the job...
ALTER TABLE Cars RENAME COLUMN Colour TO FormerColour;
Also, CHARACTER VARYING is just a synonym for TEXT if you'd rather use that to keep your queries smaller.
Jeremy Falcon
|
|
|
|