Presentation is loading. Please wait.

Presentation is loading. Please wait.

NT Net Lib Roteiro da apresentação: diagrama de fluxo de chamadas da API Win32 explicação das chamadas apresentação da classe Uma mini-biblioteca com as.

Similar presentations


Presentation on theme: "NT Net Lib Roteiro da apresentação: diagrama de fluxo de chamadas da API Win32 explicação das chamadas apresentação da classe Uma mini-biblioteca com as."— Presentation transcript:

1 NT Net Lib Roteiro da apresentação: diagrama de fluxo de chamadas da API Win32 explicação das chamadas apresentação da classe Uma mini-biblioteca com as seguintes classes: Segurança de arquivos Percorrer diretório de arquivos Mudar entradas do Registry

2 File ACL SD SID Account NameAccess Mask LookupAccountNameInitializeAclAddAccessAllowedAce SetSecurityDescriptorDaclSetSecurityDescriptorOwnerInitializeSecurityDescriptor SID Account Name SetFileSecurity File Name LookupAccountName FileSecurity

3 LookupAccountName PSID_NAME_USE peUse // address of SID-type indicator LPDWORD cbReferencedDomainName// address of size of domain string LPTSTR ReferencedDomainName// address of string for referenced domain LPDWORD cbSid// address of size of security identifier PSID Sid// address of security identifier LPCTSTR lpAccountName// address of string for account name LPCTSTR lpSystemName// address of string for system name pType\ aponta para um inteiro 1000 &\ aponta para um inteiro cujo valor é 1000 pDomain\ aponta para um buffer de 1000 bytes 1000 & pSID\ aponta para um buffer de 1000 bytes " Administrator" " Susy" Call LookupAccountName.

4 InitializeAcl DWORD dwAclRevision // revision level of access-control list DWORD nAclLength// size of access-control list PACL pAcl// address of access-control list ACL_REVISION\ constante da API 1000 pACL\ aponta para um buffer de 1000 bytes Call InitializeAcl.

5 AddAccessAllowedAce PSID pSid // address of security identifier DWORD AccessMask// access mask DWORD dwAceRevision// ACL revision level PACL pAcl// address of access-control list pSID FILE_GENERIC_READ\ constante da API ACL_REVISION\ constante da API pACL Call AddAccessAllowedAce.

6 InitializeSecurityDescriptor DWORD dwRevision // revision level PSECURITY_DESCRIPTOR pSecurityDescriptor// address of security descriptor SECURITY_DESCRIPTOR_REVISION\ constante da API pSD\ aponta para um buffer Call InitializeSecurityDescriptor.

7 SetSecurityDescriptorOwner BOOL fOwnerDefaulted // flag for default PSID psidOwner,// address of SID for owner PSECURITY_DESCRIPTOR psd,// address of security descriptor 0\ default pSID\ new owner pSD Call SetSecurityDescriptorOwner.

8 SetSecurityDescriptorDacl BOOL fDaclDefaulted // flag for default discretionary ACL PACL pAcl,// address of discretionary ACL BOOL fDaclPresent,// flag for presence of discretionary ACL PSECURITY_DESCRIPTOR psd,// address of security descriptor 0\ default pACL 1\ present pSD Call SetSecurityDescriptorDacl.

9 SetFileSecurity PSECURITY_DESCRIPTOR psd // address of security descriptor SECURITY_INFORMATION si// type of information to set LPCTSTR lpszFile// address of string for filename pSD DACL_SECURITY_INFORMATION OWNER_SECURITY_INFORMATION or " arquivo.txt" Call SetFileSecurity.

10 específico para arquivos: FILE_READ_DATA FILE_WRITE_DATA FILE_APPEND_DATA FILE_EXECUTE específico para diretórios: FILE_LIST_DIRECTORY FILE_ADD_FILE FILE_ADD_SUBDIRECTORY FILE_TRAVERSE FILE_DELETE_CHILD Access Mask específico para ambos: FILE_READ_EA FILE_WRITE_EA FILE_READ_ATTRIBUTES FILE_WRITE_ATTRIBUTES genérico: GENERIC_ALL GENERIC_EXECUTE GENERIC_READ GENERIC_WRITE geral: DELETE READ_CONTROL WRITE_DAC WRITE_OWNER SYNCHRONIZE ACCESS_SYSTEM_SECURITY

11 Class FileSecurity AccountName Owner AccountName Read AccountName Change FileName Set 1. 2. 3. FileSecurity sysFile " Administrator" Owner: sysFile " Users" Read: sysFile " gaga.txt" Set: sysFile

12 Handle Key Name Value Name RegOpenKeyEx Value Handle Computer Name RegConnectRegistryRegSetValueEx Registry Entry RegCloseKey Registry

13 RegConnectRegistry PHKEY phkResult // address of buffer for remote registry handle HKEY hKey,// predefined registry handle LPTSTR lpszComputerName,// address of name of remote computer pConnectHandle\ aponta para um inteiro HKEY_LOCAL_MACHINE\ constante da API " SUSY" Call RegConnectRegistry.

14 RegOpenKeyEx PHKEY phkResult // address of handle of open key REGSAM samDesired,// security access mask DWORD dwReserved,// reserved LPCTSTR lpszSubKey,// address of name of subkey to open HKEY hKey,// handle of open key pKeyHandle\ aponta para um inteiro KEY_WRITE\ constante da API 0\ reservado " System\CurrentControlSet\Services\Browser" ConnectHandle\ o valor mesmo Call RegOpenKeyEx.

15 RegSetValueEx DWORD cbData // size of value data CONST BYTE * lpData,// address of value data DWORD dwType,// flag for value type DWORD Reserved,// reserved LPCTSTR lpValueName,// address of value to set HKEY hKey,// handle of key to set value for 4\ 4 bytes de dados 2 &\ aponta para um inteiro cujo valor é 2 REG_DWORD\ tipo é dword - constante da API 0\ reservado " Start" KeyHandle\ o valor mesmo Call RegSetValueEx.

16 RegCloseKey HKEY hKey // handle of key to close KeyHandle\ o valor mesmo Call RegCloseKey.

17 Class Registry ClientNumber Connect KeyName ValueName IntegerValue SetDWORD KeyName ValueName StringValue SetSZ KeyName ValueName StringValue SetESZ 1. 2. 3. Registry remoto 23 Connect: remoto " System\CurrentControlSet\Services\Browser” " Start" 2 SetDWORD: remoto Disconnect: remoto Disconnect

18 FindNextFile Handle *.* FindFirstFile WIN32_FIND_DATA GetLastErrorFindClose SetCurrentDirectory FILE_ATTRIBUTE_DIRECTORY ERROR_NO_ MORE_FILES FALSE TRUE Browse

19 FindFirstFile LPWIN32_FIND_DATA lpFindFileData // address of returned information LPCTSTR lpFileName,// address of name of file to search for pFIND_DATA\ aponta para um buffer " *.*" Call FindFirstFile to hFindFile

20 FindNextFile LPWIN32_FIND_DATA lpFindFileData // address of structure for data on found file HANDLE hFindFile,// handle of search pFIND_DATA\ aponta para um buffer hFindFile Call FindNextFile.

21 typedef struct _WIN32_FIND_DATA { DWORDdwFileAttributes; FILETIMEftCreationTime; FILETIMEftLastAccessTime; FILETIMEftLastWriteTime; DWORDnFileSizeHigh; DWORDnFileSizeLow; DWORDdwReserved0; DWORDdwReserved1; TCHARcFileName[ MAX_PATH ]; TCHARcAlternateFileName[ 14 ]; } WIN32_FIND_DATA; WIN32_FIND_DATA

22 dwFileAttributes FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_COMPRESSED FILE_ATTRIBUTE_DIRECTORY FILE_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_TEMPORARY

23 FindClose HANDLE hFindFile,// handle of search hFindFile Call FindClose.

24 SetCurrentDirectory LPCTSTR lpszCurDir // address of name of new current directory " Tese" Call SetCurrentDirectory.

25 GetLastError Call GetLastError.

26 Class DirBrowse pAvoidList Avoid Show pFunction ProcessFiles 1. 2. DirBrowse List : PrintFileName CR Show: List ;\ definir função ' PrintFileName ProcessFiles: List\ executar função para cada arquivo


Download ppt "NT Net Lib Roteiro da apresentação: diagrama de fluxo de chamadas da API Win32 explicação das chamadas apresentação da classe Uma mini-biblioteca com as."

Similar presentations


Ads by Google