What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! General » How was Plus! done?

How was Plus! done?
Author: Message:
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: How was Plus! done?
Here is a pretty good list of what you should and shouldn't do when you are creating DllMain. See the document for more details.

quote:
Originally posted by http://www.microsoft.com/whdc/driver/kernel/dll_bestprac.mspx

You should never perform the following tasks from within DllMain:
  • Call LoadLibrary or LoadLibraryEx (either directly or indirectly). This can cause a deadlock or a crash.
  • Synchronize with other threads. This can cause a deadlock.
  • Acquire a synchronization object that is owned by code that is waiting to acquire the loader lock. This can cause a deadlock.
  • Initialize COM threads by using CoInitializeEx. Under certain conditions, this function can call LoadLibraryEx.
  • Call the registry functions. These functions are implemented in Advapi32.dll. If Advapi32.dll is not initialized before your DLL, the DLL can access uninitialized memory and cause the process to crash.
  • Call CreateProces. Creating a process can load another DLL.
  • Call ExitThread. Exiting a thread during DLL detach can cause the loader lock to be acquired again, causing a deadlock or a crash.
  • Call CreateThread. Creating a thread can work if you do not synchronize with other threads, but it is risky.
  • Create a named pipe or other named object (Windows 2000 only). In Windows 2000, named objects are provided by the Terminal Services DLL. If this DLL is not initialized, calls to the DLL can cause the process to crash.
  • Use the memory management function from the dynamic C Run-Time (CRT). If the CRT DLL is not initialized, calls to these functions can cause the process to crash.
  • Call functions in User32.dll or Gdi32.dll. Some functions load another DLL, which may not be initialized.
  • Use managed code.

The following tasks are safe to perform within DllMain:
  • Initialize static data structures and members at compile time.
  • Create and initialize synchronization objects.
  • Allocate memory and initialize dynamic data structures (avoiding the functions listed above.)
  • Set up thread local storage (TLS).
  • Open, read from, and write to files.
  • Call functions in Kernel32.dll (except the functions that are listed above).
  • Set global pointers to NULL, putting off the initialization of dynamic members. In Microsoft Windows Vista™, you can use the one-time initialization functions to ensure that a block of code is executed only once in a multithreaded environment.

02-20-2007 02:32 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How was Plus! done? - by muttantegg on 02-17-2007 at 12:41 AM
RE: How was Plus! done? - by ShawnZ on 02-17-2007 at 12:47 AM
RE: How was Plus! done? - by muttantegg on 02-17-2007 at 11:28 AM
RE: How was Plus! done? - by Baggins on 02-17-2007 at 12:26 PM
RE: How was Plus! done? - by muttantegg on 02-17-2007 at 02:50 PM
RE: How was Plus! done? - by hmaster on 02-17-2007 at 03:03 PM
RE: How was Plus! done? - by vikke on 02-17-2007 at 03:52 PM
RE: How was Plus! done? - by matty on 02-17-2007 at 03:56 PM
RE: RE: How was Plus! done? - by vikke on 02-17-2007 at 04:00 PM
RE: How was Plus! done? - by muttantegg on 02-17-2007 at 04:24 PM
RE: How was Plus! done? - by vikke on 02-17-2007 at 04:27 PM
RE: How was Plus! done? - by Patchou on 02-18-2007 at 08:06 AM
RE: RE: How was Plus! done? - by vikke on 02-18-2007 at 03:34 PM
RE: How was Plus! done? - by muttantegg on 02-18-2007 at 04:22 PM
RE: How was Plus! done? - by vikke on 02-18-2007 at 04:40 PM
RE: How was Plus! done? - by muttantegg on 02-19-2007 at 12:49 PM
RE: How was Plus! done? - by vikke on 02-19-2007 at 04:37 PM
RE: How was Plus! done? - by Patchou on 02-19-2007 at 07:45 PM
RE: How was Plus! done? - by TheSteve on 02-20-2007 at 02:32 AM
RE: How was Plus! done? - by muttantegg on 02-20-2007 at 04:35 AM
RE: How was Plus! done? - by Patchou on 02-20-2007 at 06:26 AM
RE: RE: How was Plus! done? - by vikke on 02-20-2007 at 07:41 AM
RE: How was Plus! done? - by muttantegg on 02-20-2007 at 10:15 AM
RE: How was Plus! done? - by vikke on 02-20-2007 at 10:18 AM
RE: How was Plus! done? - by muttantegg on 02-20-2007 at 10:26 AM
RE: How was Plus! done? - by muttantegg on 02-20-2007 at 11:47 PM
RE: How was Plus! done? - by vikke on 02-21-2007 at 09:50 AM
RE: How was Plus! done? - by muttantegg on 02-21-2007 at 05:26 PM
RE: How was Plus! done? - by Patchou on 02-22-2007 at 05:43 AM
RE: How was Plus! done? - by shlomifr on 08-10-2009 at 12:00 PM
RE: How was Plus! done? - by ShawnZ on 08-10-2009 at 03:06 PM
RE: How was Plus! done? - by shlomifr on 08-10-2009 at 03:58 PM
RE: How was Plus! done? - by ShawnZ on 08-10-2009 at 04:05 PM
RE: How was Plus! done? - by shlomifr on 08-11-2009 at 09:51 AM
RE: How was Plus! done? - by Patchou on 08-11-2009 at 09:01 PM
RE: How was Plus! done? - by shlomifr on 08-12-2009 at 06:11 AM
RE: How was Plus! done? - by Patchou on 08-14-2009 at 05:59 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On