ObjFW  Diff

Differences From Artifact [c3f493864c]:

To Artifact [0f92abda7c]:


161
162
163
164
165
166
167

168

169
170
171

172
173
174
175

176
177
178
179
180
181
182
183





184
185

186
187
188
189
190
191
192
193
194
195

196
197
198

199
200
201
202
203
204
205
161
162
163
164
165
166
167
168

169
170
171

172
173
174
175

176
177
178
179





180
181
182
183
184
185

186
187
188
189
190
191
192
193
194
195

196
197
198

199
200
201
202
203
204
205
206







+
-
+


-
+



-
+



-
-
-
-
-
+
+
+
+
+

-
+









-
+


-
+







	}
# endif
#elif defined(OF_WINDOWS)
# ifdef OF_HAVE_FILES
	void *pool = objc_autoreleasePoolPush();

	@try {
		of_string_encoding_t encoding = [OFLocale encoding];
		wchar_t systemDir[PATH_MAX];
		char systemDir[PATH_MAX];
		UINT systemDirLen;
		OFString *systemDirString;
		const of_char16_t *path;
		const char *path;
		void *buffer;
		DWORD bufferLen;

		systemDirLen = GetSystemDirectoryW(systemDir, PATH_MAX);
		systemDirLen = GetSystemDirectoryA(systemDir, PATH_MAX);
		if (systemDirLen == 0)
			return;

		systemDirString = [OFString
		    stringWithUTF16String: systemDir
				   length: systemDirLen];
		path = [systemDirString stringByAppendingPathComponent:
		    @"kernel32.dll"].UTF16String;
		systemDirString = [OFString stringWithCString: systemDir
						     encoding: encoding
						       length: systemDirLen];
		path = [[systemDirString stringByAppendingPathComponent:
		    @"kernel32.dll"] cStringWithEncoding: encoding];

		if ((bufferLen = GetFileVersionInfoSizeW(path, NULL)) == 0)
		if ((bufferLen = GetFileVersionInfoSizeA(path, NULL)) == 0)
			return;
		if ((buffer = malloc(bufferLen)) == 0)
			return;

		@try {
			void *data;
			UINT dataLen;
			VS_FIXEDFILEINFO *info;

			if (!GetFileVersionInfoW(path, 0, bufferLen, buffer))
			if (!GetFileVersionInfoA(path, 0, bufferLen, buffer))
				return;

			if (!VerQueryValueW(buffer, L"\\", &data, &dataLen) ||
			if (!VerQueryValueA(buffer, "\\", &data, &dataLen) ||
			    dataLen < sizeof(info))
				return;

			info = (VS_FIXEDFILEINFO *)data;

			operatingSystemVersion = [[OFString alloc]
			    initWithFormat: @"%u.%u.%u",