1.
It must be remembered that the existence time of the kernel object can be longer than the process for creating the object.
2.
Kernel objects can be protected by security descriptors. The security descriptor is used to describe who created the object, who can access or use the object, and who has no permission to access the object. Security descriptors are usually used when writing server applications. If you write client applications, you can ignore this feature of kernel objects.
3.
Handle createthread (
Psecurity_attributes PSA,
DWORD dwstacksize,
Pthread_start_routine pfnstartaddr,
Pvoid pvparam,
DWORD dwcreationflags,
Pdword pdwfhreadid );
Handee createfile (
Pctstr pszfilename,
DWORD dwdesiredaccebs,
DWORD dw1_mode,
Psecurity_attributes PSA,
DWORD dwcreationdistribution,
DWORD dwflagsandattnbutes,
Handee htemplatefile );
Handle createfilemapping (
Handle hfile,
Psecurity_attributes PSA,
DWORD flprotect,
DWORD dwmdximumsizchigh,
DWORD dwmaximumsizelow,
Pctstr pszname );
Handle createsemaphore (
Psecurity_attributes PSA,
Long linitialcount,
Long lmaximumcount,
Pctstr pszname );
Handle createwaitabletimer (
Pslcurity_attributes PSA,
Bool bmanualreset,
Pctstr pszname );
Handle createjobobject (
Psecurity_attributes PSA,
Pctstr pszname );
Another way to share objects by name is that a process does not call the C r e a t e * function, but calls one of the o p e * functions shown below:
Handle openmutex (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname );
Handle openevent (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname );
Handle opensemaphore (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname ),
Handle openwaitabletimer (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname );
Handle openfilemapping (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname );
Handle openjob0bject (
DWORD dwdesiredaccess,
Bool binherithandle,
Pctstr pszname );
4.
If a function is called to create a kernel object but the call fails, the returned handle value is usually 0 (n u L ). This occurs because the system memory is very short or security problems are encountered. However, when a few functions fail to run, the returned handle value is-1 (I n va l I D _ H a n d l e _ va L U E ). For example, if C r e a t e f I l e fails to open the specified file, then it returns I n va l I D _ H a n d l e _ va L U E, instead of returning n u L. Be cautious when viewing the function return values of the created kernel object. Note that only when the C r e a t e f I l e function is called, this value can be compared with I n va l I D _ H a n d l e _ va L U E.
5.
No matter how the kernel object is created, specify to the system that the operation on the object will be terminated by calling c l o s e h a n d l E:
Bool closehandle (handle hobj );