---- temporal's profile picture

Published by

published

Category: Technology

2--Win32

Esto es una prueba de CSS

Todo este contenido pertenece a https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html#org137a523


Entonces, el problema ahora es como le corto el blog para ir comentando en apartados 

dfadfs

1.7 WinAPI C Data Types

1.7.1 Hungarian Notation

Windows API uses the Hungarian notation which was intruduced by Charles Simonyi at Microsoft and Xerox PARC. This notation uses a prefix to denote the variable type.

Notes and remarks:

  • Many sources advises against this notation and nowadays many IDEs can provide a variable type by just hovering the mouse over it.
  • Understanding the notation can help to reason about the Windows API.
  • The HN notation is not standardized.

Form:

TYPE-PREFIX + NAME + QUALIFIER 
PrefixTypeDescriptionVariable Name Example
bBYTE or BOOLbooleanBOOL bFlag; BOOL bIsOnFocus
ccharCharacter - 1 bytechar cLetter
wWORDword 
dwDWORDdouble word 
iintintegerint iNumberOfNodes
u32unsigned [int]unsigned integerunsigned u32Nodes
f or fpfloatfloat point - single precisionfInterestRate
ddoublefloat point - double precisiondRateOfReturn
n short int 
    
szchar* or const char*Pointer to null terminated char array.char* szButtonLabel
    
HHANDLEHandleHANDLE hModule; HMODULE hInstance;
p-Pointerdouble* pdwMyPointer;
lp-Long Pointerint* lpiPointer;
fn-Function pointer 
lpsz Long Pointer 
LP Long Pointer 
    
I-Interface (C++ interface class)class IDrawable …
S-Struct declarationstruct SContext { … }
C-Class declarationclass CUserData{ … }
m_-Private member variable name of some classm_pszFileName
s_-Static member of a classstatic int s_iObjectCount
    



Examples in Windows API - Function Create Process:

BOOL <span class="org-type" style="color:rgb(18,255,237);">WINAPI</span> <span class="org-function-name" style="color:rgb(91,161,207);">CreateProcess</span><span class="org-rainbow-delimiters-depth-1" style="color:rgb(112,113,131);">(</span>
  _In_opt_    <span class="org-type" style="color:rgb(18,255,237);">LPCTSTR</span>               <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpApplicationName</span>,      <span class="org-comment-delimiter" style="color:rgb(141,141,132);">// </span><span class="org-comment" style="color:#90EE90;font-style:italic;font-weight:bolder;">const char*</span>
  _Inout_opt_ <span class="org-type" style="color:rgb(18,255,237);">LPTSTR</span>                <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpCommandLine</span>,          <span class="org-comment-delimiter" style="color:rgb(141,141,132);">// </span><span class="org-comment" style="color:#90EE90;font-style:italic;font-weight:bolder;">char*</span>
  _In_opt_    <span class="org-type" style="color:rgb(18,255,237);">LPSECURITY_ATTRIBUTES</span> <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpProcessAttributes</span>,
  _In_opt_    <span class="org-type" style="color:rgb(18,255,237);">LPSECURITY_ATTRIBUTES</span> <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpThreadAttributes</span>,     <span class="org-comment-delimiter" style="color:rgb(141,141,132);">// </span>
  _In_        <span class="org-type" style="color:rgb(18,255,237);">BOOL</span>                  <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">bInheritHandles</span>,
  _In_        <span class="org-type" style="color:rgb(18,255,237);">DWORD</span>                 <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">dwCreationFlags</span>,
  _In_opt_    <span class="org-type" style="color:rgb(18,255,237);">LPVOID</span>                <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpEnvironment</span>,
  _In_opt_    <span class="org-type" style="color:rgb(18,255,237);">LPCTSTR</span>               <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpCurrentDirectory</span>,
  _In_        <span class="org-type" style="color:rgb(18,255,237);">LPSTARTUPINFO</span>         <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpStartupInfo</span>,
  _Out_       <span class="org-type" style="color:rgb(18,255,237);">LPPROCESS_INFORMATION</span> <span class="org-variable-name" style="color:#00BFFF;font-weight:bolder;">lpProcessInformation</span>
<span class="org-rainbow-delimiters-depth-1" style="color:rgb(112,113,131);">)</span>;
  • dwCreationFlags => (dw) prefix Indicates that the variable is a DWORD (int)
  • lpEnvironment => (lp - Long Pointer) Indicates that variable is a void pointer => (LPVOID = void* )
  • lpApplicationName => Indicates that the variable is a pointer to char or (LPCSTR = const char*)


k1+hcfSOko5V2M8yM79bYaiXWnHuPOP73Cws0sgOZXN2DAAAAAElFTkSuQmCC

Esta parte de la documentación presenta problemas de formato y no sé por qué se pone el bloque  









Furthere Reading:

Estoy aquí exactamente, y ahora mismo existe el problema donde el copypaste no consigue modficarse porque no teng acceso al html que usa este blog, así que no puedo ni hacerle un recorte manualmente 

    
ddddd

Esto es un parrafado pegado

Creo que parece que se corta, pero estoy dentro del bloque todavía 

Los formatos son amplios en este tipo de blog, pero a pesar de eso también parece que hay limitaciones para el formateo, y no parece tampoco que haya una forma de revertirlo


1.7.2 General Terminology

  • Handle - Is a unsigned integer number assigned to processes, windows, buttons, resources and etc. Actually, it is an opaque pointer to some system data structure (Kernel Object), similar to Unix's file descriptor pointer. The purpose of using handles or opaque pointer is to hide the implementation of those data structures allowing implementators to change their inner working without disrupting application developers. This approach gives a pseudo object-oriented interface to the Windows API. See also:
    • Note: A handle can be an obfuscated pointer exposed as an integer, void pointer void* (also opaque pointer) or ordinary opaque pointer (pointer to a C-struct or class which implementation is not exposed).
Se suele comentar mucho a Unix, y sin embargo es un error para los lectores nuevos, porque yo es la primera vez que estoy leyendo Win32, y por tanto la herencia de Unix puede ser histórica, yo lo entiendo, pero esa herencia se transforma en un "esto ya existía en Unix", y es un comentario muy peligroso en cualquier documentación nueva, porque entonces se convierte en "revisa la documentación vieja".

En este caso la documentación es bastante buena, yo no digo que no lo sea, pero este tipo de comentarios de sistemas heredados o relaciones me está quemando mucho.

Creo que la traducción de Handle sería algo similar atirador, manejador, las manillas por ejemplo, pero lo más similar es un asa o yo al menos me suelo imaginar el punto de control de photoshop
Handle Images – Browse 5,997,101 Stock Photos, Vectors, and Video | Adobe  Stock

Anchor Point vector icon 21715436 Vector Art at Vecteezy
Es que realmente me cuesta mucho iminar cuál es la labor de Handle por descripción, y parece quedarse un poco corta porque no hay  un ejemplo como en Learncpp puesto en línea de comandos y es confuso 


  • Types of Kernel Objects (Handle is a numeric value related to the pointer to kernel object C-struct). The name "object" comes from the idea that it is possible to access the kernel data structure pointer by the handle using the Win32 API functions. It works in a similar way to classical object oriented programming where the data structure and internal representation can only be accessed by the class methodos.
    • Symbolic Link
    • Process
      • A running program, executable. A process has its own address space, data, stack and heap.
    • Job
      • Group of processes managed as group.
    • File
      • Open file or I/O device.
    • Token
      • Security token used by many Win32 functions.
    • Event
      • Synchronization object used for notification.
    • Threads
      • Smallest unit of execution within a process.
    • Semaphore
    • Mutex
    • Timer
      • Object which provides notification after a certain period is elapsed.

References:

1.7.3 Common Data Types

Data TypeDefinitionDescription
BOOLtypedef int BOOLBoolean variable true (non zero) or false (zero or 0)
BYTEtypedef unsigned char BYTEA byte, 8 bits.
CCHARtypedef char CHARAn 8-bit Windows (ANSI) character.
   
DWORDtypedef unsigned long DWORDA 32-bit unsigned integer. The range is 0 through 4294967295 decimal.
DWORDLONGtypedef unsigned __int64 DWORDLONG64 bits usigned int.
DWORD32typedef unsigned int DWORD32A 32-bit unsigned integer.
DWORD64typedef unsigned __int64 DWORD64A 64-bit unsigned integer.
   
   
FLOATtypedef float FLOATA floating-point variable.
   
INT8typedef signed char INT8An 8-bit signed integer.
INT16typedef signed short INT16A 16-bit signed integer.
INT32typedef signed int INT32A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal.
INT64typedef signed __int64 INT64A 64-bit signed integer.
   
   
LPBOOLtypedef BOOL far *LPBOOL;A pointer to a BOOL.
LPBYTEtypedef BYTE far *LPBYTEA pointer to a BYTE.
LPCSTR, PCSTRtypedef __nullterminated CONST CHAR *LPCSTRpointer to a constant null-terminated string of 8-bit Windows (ANSI) characters.
LPCVOIDtypedef CONST void *LPCVOID;A pointer to a constant of any type.
LPCWSTR, PCWSTRtypedef CONST WCHAR *LPCWSTR;A pointer to a constant null-terminated string of 16-bit Unicode characters.
LPDWORDtypedef DWORD *LPDWORDA pointer to a DWORD.
LPSTRtypedef CHAR *LPSTR;A pointer to a null-terminated string of 8-bit Windows (ANSI) characters.
LPTSTR An LPWSTR if UNICODE is defined, an LPSTR otherwise.
LPWSTRtypedef WCHAR *LPWSTR;A pointer to a null-terminated string of 16-bit Unicode characters.
PCHARtypedef CHAR *PCHAR;A pointer to a CHAR.
   
CHARANSI Char or char 
WCHARWide character 16 bits UTF16 
TCHAR-A WCHAR if UNICODE is defined, a CHAR otherwise.
UCHARtypedef unsigned char UCHAR;An unsigned CHAR.
   
WPARAMtypedef UINT_PTR WPARAM;A message parameter.
   
   

1.7.4 Other data types

  
  
HANDLE32 bits integer used as a handle
HDCHandle to device context
HWND32-bit unsigned integer used as handle to a window
LONG 
LPARAM 
LPSTR 
LPVOIDGeneric pointer similar to void*
LRESULT 
UINTUnsigned integer
WCHAR16-bit Unicode character or Wide-Character
WPARAM 
HINSTANCE 
Faltan de verdad muchos ejemplos, pero espero que al terminar la lectura haya algo que ayude al menos, esta documentación es como mínimo una tabla 



Acabo de descubrir el botón del html, solo para darme cuenta de que no está dividido automáticamente 

XKqKwAAAABJRU5ErkJggg==

Pero bueno, está bien


Yo intentaré reactualizar esto, prefier hacer publicaciones de chaptesr, pero no hay otro remedio y prefiero que no haya tantos usuarios dentro si es que hay usuarios activos, porque estos blogs son muy sucios 









Kudos: 0

Comments