Commit 070d9f91 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

reg: Correct the sense of return values for registry operations.

parent 726891ad
...@@ -147,14 +147,14 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -147,14 +147,14 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
if (key_name[0]=='\\' && key_name[1]=='\\') if (key_name[0]=='\\' && key_name[1]=='\\')
{ {
reg_message(STRING_NO_REMOTE); reg_message(STRING_NO_REMOTE);
return 0; return 1;
} }
p = strchrW(key_name,'\\'); p = strchrW(key_name,'\\');
if (!p) if (!p)
{ {
reg_message(STRING_INVALID_KEY); reg_message(STRING_INVALID_KEY);
return 0; return 1;
} }
p++; p++;
...@@ -162,13 +162,13 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -162,13 +162,13 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
if (!root) if (!root)
{ {
reg_message(STRING_INVALID_KEY); reg_message(STRING_INVALID_KEY);
return 0; return 1;
} }
if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS) if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS)
{ {
reg_message(STRING_INVALID_KEY); reg_message(STRING_INVALID_KEY);
return 0; return 1;
} }
if (value_name || data) if (value_name || data)
...@@ -190,7 +190,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -190,7 +190,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
{ {
RegCloseKey(subkey); RegCloseKey(subkey);
reg_message(STRING_INVALID_CMDLINE); reg_message(STRING_INVALID_CMDLINE);
return 0; return 1;
} }
if (data) if (data)
...@@ -203,7 +203,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -203,7 +203,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
RegCloseKey(subkey); RegCloseKey(subkey);
reg_message(STRING_SUCCESS); reg_message(STRING_SUCCESS);
return 1; return 0;
} }
static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
...@@ -220,14 +220,14 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -220,14 +220,14 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
if (key_name[0]=='\\' && key_name[1]=='\\') if (key_name[0]=='\\' && key_name[1]=='\\')
{ {
reg_message(STRING_NO_REMOTE); reg_message(STRING_NO_REMOTE);
return 0; return 1;
} }
p = strchrW(key_name,'\\'); p = strchrW(key_name,'\\');
if (!p) if (!p)
{ {
reg_message(STRING_INVALID_KEY); reg_message(STRING_INVALID_KEY);
return 0; return 1;
} }
p++; p++;
...@@ -235,19 +235,19 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -235,19 +235,19 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
if (!root) if (!root)
{ {
reg_message(STRING_INVALID_KEY); reg_message(STRING_INVALID_KEY);
return 0; return 1;
} }
if (value_name && value_empty) if (value_name && value_empty)
{ {
reg_message(STRING_INVALID_CMDLINE); reg_message(STRING_INVALID_CMDLINE);
return 0; return 1;
} }
if (value_empty && value_all) if (value_empty && value_all)
{ {
reg_message(STRING_INVALID_CMDLINE); reg_message(STRING_INVALID_CMDLINE);
return 0; return 1;
} }
if (!force) if (!force)
...@@ -260,16 +260,16 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -260,16 +260,16 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS) if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS)
{ {
reg_message(STRING_CANNOT_FIND); reg_message(STRING_CANNOT_FIND);
return 0; return 1;
} }
reg_message(STRING_SUCCESS); reg_message(STRING_SUCCESS);
return 1; return 0;
} }
if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS) if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS)
{ {
reg_message(STRING_CANNOT_FIND); reg_message(STRING_CANNOT_FIND);
return 0; return 1;
} }
if (value_all) if (value_all)
...@@ -283,7 +283,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -283,7 +283,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
{ {
RegCloseKey(subkey); RegCloseKey(subkey);
reg_message(STRING_INVALID_CMDLINE); reg_message(STRING_INVALID_CMDLINE);
return 0; return 1;
} }
rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
...@@ -292,7 +292,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -292,7 +292,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
{ {
/* FIXME: failure */ /* FIXME: failure */
RegCloseKey(subkey); RegCloseKey(subkey);
return 0; return 1;
} }
maxValue++; maxValue++;
szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR)); szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR));
...@@ -320,7 +320,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -320,7 +320,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
{ {
RegCloseKey(subkey); RegCloseKey(subkey);
reg_message(STRING_CANNOT_FIND); reg_message(STRING_CANNOT_FIND);
return 0; return 1;
} }
} }
else if (value_empty) else if (value_empty)
...@@ -330,7 +330,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ...@@ -330,7 +330,7 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
RegCloseKey(subkey); RegCloseKey(subkey);
reg_message(STRING_SUCCESS); reg_message(STRING_SUCCESS);
return 1; return 0;
} }
static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment