MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / CreateIniFileEx

Function CreateIniFileEx

src/Notepad2.c:5225–5252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5223 return ( CreateIniFileEx ( szIniFile ) );
5224}
5225int CreateIniFileEx ( LPCWSTR lpszIniFile )
5226{
5227 if ( *lpszIniFile ) {
5228 HANDLE hFile;
5229 WCHAR *pwchTail;
5230 if ( pwchTail = StrRChrW ( lpszIniFile, NULL, L'\\' ) ) {
5231 *pwchTail = 0;
5232 SHCreateDirectoryEx ( NULL, lpszIniFile, NULL );
5233 *pwchTail = L'\\';
5234 }
5235 hFile = CreateFile ( lpszIniFile,
5236 GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
5237 NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
5238 dwLastIOError = GetLastError();
5239 if ( hFile != INVALID_HANDLE_VALUE ) {
5240 if ( GetFileSize ( hFile, NULL ) == 0 ) {
5241 DWORD dw;
5242 WriteFile ( hFile, ( LPCVOID ) L"\xFEFF[Notepad2]\r\n", 26, &dw, NULL );
5243 }
5244 CloseHandle ( hFile );
5245 return ( 1 );
5246 } else {
5247 return ( 0 );
5248 }
5249 } else {
5250 return ( 0 );
5251 }
5252}
5253//=============================================================================
5254//
5255// UpdateToolbar()

Callers 2

MsgCommandFunction · 0.85
CreateIniFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected