0% found this document useful (0 votes)
7 views2 pages

CS609 Assignment 1

cs508

Uploaded by

Sidra asif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

CS609 Assignment 1

cs508

Uploaded by

Sidra asif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CS609

BC170202271

Question 1:
1. The file is created for read/write both.
FILE_ATTRIBUTES_NORMAL
2. The file is not required to be created for sharing.
dwShareMode: 0 Signature That File will Not Be Shared
3. Security attributes should be default.
IpsecurityAttributes
4. If the same name filename exists, then it is overwritten by the new file.
CREATE_ALWAYS
5. Set all other parameters as NULL.
array_create(NULL,10);
Question 2:
#include <windows.h>

#include <everything.h>

#include <strsafe.h>

void ErrorExit(LPTSTR lpszFunction)

LPVOID lpMsgBuf;

LPVOID lpDisplayBuf;

DWORD dw = GetLastError();

FormatMessage(

FORMAT_MESSAGE_ALLOCATE_BUFFER |

FORMAT_MESSAGE_FROM_SYSTEM |

FORMAT_MESSAGE_IGNORE_INSERTS,

NULL,
dw,

MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),

(LPTSTR) &lpMsgBuf,

0, NULL );

lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,

(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR));

StringCchPrintf((LPTSTR)lpDisplayBuf,

LocalSize(lpDisplayBuf) / sizeof(TCHAR),

TEXT("%s failed with error %d: %s"),

lpszFunction, dw, lpMsgBuf);

MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);

LocalFree(lpMsgBuf);

LocalFree(lpDisplayBuf);

ExitProcess(dw);

void main()

if(!GetProcessId(NULL))

ErrorExit(TEXT("GetProcessId"));

You might also like